Dress to Impress, a big fancy Neopets customization tool!
Find a file
Emi Matchu 258b360ff2 Oops, fix infinite autosaving loop!
A bit of a hack, because the thing triggering it was also a bit of a
hack? I feel like there's something we gotta do with refactoring how
our multiple concepts of state are managed… but in any case! This seems
to keep basic outfit-loading working, while no longer getting us
trapped in autosave loops!

Here's how I reproduced the bug:
1. Open a saved outfit.
2. Set the browser devtools to apply a latency of 5sec to all requests.
3. Add an item to the outfit, and wait for the autosave to start.
4. While it still says "Saving", remove the item again.
5. Watch how, when the first autosave request comes in, the item is
   re-applied to the outfit, then autosave gets stuck looping forever.

The issue was that, when an outfit finishes saving, the change in
outfit data was triggering this effect in `useOutfitState` that was
*meant* to *initialize* local state from the saved outfit, not to keep
them in sync all the time. (In general, when saved outfit data comes
back from the server, we don't want to use it to "fix" local outfit
state in the case of discrepancies, because the most common source of
discrepancy will be the user having made further changes!)

But anyway, one thing I didn't realize is that we *were* depending on
this hacky hook to do more than I thought: it was responsible for
syncing `id` and `appearanceId` to the local state after saving the
outfit. So, I replaced the `rename` action dispatch here with a new
action that explicitly sets all fields the server is responsible for!
2024-02-25 10:37:08 -08:00
.devcontainer Save last trade activity time onto User 2024-01-19 00:00:46 -08:00
.husky Set up eslint for wardrobe-2020 2023-11-02 18:11:07 -07:00
app Oops, fix infinite autosaving loop! 2024-02-25 10:37:08 -08:00
bin Upgrade to Rails 7.1.1 2023-10-25 15:05:31 -07:00
config Remove unused /colors/pet_types route 2024-02-24 15:51:40 -08:00
db Drop item_translations table 2024-02-20 17:01:54 -08:00
deploy Create NeopetsMediaArchive, read the actual manifests for Alt Styles 2024-02-23 12:02:39 -08:00
lib Create swf_assets:manifests:load task to save all manifest files 2024-02-23 14:06:49 -08:00
public Add custom 502 error page, for when the app goes down but nginx is up 2024-02-19 13:19:31 -08:00
test Save last trade activity time onto User 2024-01-19 00:00:46 -08:00
vendor Run bundle update 2024-02-22 11:48:32 -08:00
.eslintrc.json Set up eslint for wardrobe-2020 2023-11-02 18:11:07 -07:00
.gitignore Add .env.* to gitignore 2023-10-27 17:44:12 -07:00
.ruby-version Finish migrating to Ruby 3.3.0 2024-02-22 12:05:02 -08:00
.yarnrc.yml Upgrade to Yarn 4.0.2 2024-01-14 23:05:53 -08:00
config.ru Upgrade to Rails 6.1.7.4 2023-10-23 19:05:07 -07:00
falcon.rb Remove supervisor from the Falcon process? 2024-01-24 00:20:23 -08:00
Gemfile Finish migrating to Ruby 3.3.0 2024-02-22 12:05:02 -08:00
Gemfile.lock Finish migrating to Ruby 3.3.0 2024-02-22 12:05:02 -08:00
LICENSE.md Update our license 2023-10-23 19:04:56 -07:00
package.json Upgrade to Yarn 4.0.2 2024-01-14 23:05:53 -08:00
Procfile.dev Fix bin/dev to use the right settings in development 2023-11-02 16:54:39 -07:00
Rakefile Uninstall resque 2023-10-23 19:05:04 -07:00
README.md Oops, needs to be a README.md file! 2023-10-25 16:31:41 -07:00
yarn.lock Upgrade to Yarn 4.0.2 2024-01-14 23:05:53 -08:00

Dress to Impress beach logo

Dress to Impress

Oh! We've been revitalizing the Rails app! Fun!

There'll be more to say about it here soon :3