uwblueprint / shoe-project

👠👟 Repo for The Shoe Project @ UWBlueprint
https://map.theshoeproject.online
MIT License
6 stars 0 forks source link

fix: Load before redirect #358

Closed AbhiPrasad closed 3 years ago

AbhiPrasad commented 3 years ago

Running the redirect before the leads to some awkward transition states, this aims to fix that.

nimwijetunga commented 3 years ago

hmm it still seems as though when i make changes (don't publish) then logout those changes still persist. Honestly this probably not too much of a big deal since this edge case should be quite rare so if the fix is not simple then might not be necessary

AbhiPrasad commented 3 years ago

hmm it still seems as though when i make changes (don't publish) then logout those changes still persist. Honestly this probably not too much of a big deal since this edge case should be quite rare so if the fix is not simple then might not be necessary

~Oh yeah sorry I was getting to that. It happens because we actually do a mutate (PUT) request everytime we flip a switch, see: https://github.com/uwblueprint/shoe-project/blob/main/ui/src/pages/Admin/AllStories/index.tsx#L411-L428.~

~Should we remove the eager mutate? I don't think we want that to happen right?~

Nvm that was cap, idk whats going on lol

hanlinc27 commented 3 years ago

I believe it's because of https://github.com/uwblueprint/shoe-project/blob/3937505e502bf37e19340a445c9c543d5f067e69/ui/src/pages/Admin/AllStories/index.tsx#L376 https://swr.vercel.app/docs/options which was needed to prevent the page from making a request even when we pressed "cancel" for the prompt asking about navigating away. For instance, commenting that out means that when we log out and log in the changes don't persist.

nimwijetunga commented 3 years ago

I believe it's because of https://github.com/uwblueprint/shoe-project/blob/3937505e502bf37e19340a445c9c543d5f067e69/ui/src/pages/Admin/AllStories/index.tsx#L376

https://swr.vercel.app/docs/options

which was needed to prevent the page from making a request even when we pressed "cancel" for the prompt asking about navigating away. For instance, commenting that out means that when we log out and log in the changes don't persist.

Did it work when you commented it out @hanlinc27?

hanlinc27 commented 3 years ago

I believe it's because of https://github.com/uwblueprint/shoe-project/blob/3937505e502bf37e19340a445c9c543d5f067e69/ui/src/pages/Admin/AllStories/index.tsx#L376

https://swr.vercel.app/docs/options which was needed to prevent the page from making a request even when we pressed "cancel" for the prompt asking about navigating away. For instance, commenting that out means that when we log out and log in the changes don't persist.

Did it work when you commented it out @hanlinc27?

Yes but then the prompt cancel still sends a request when the warning shows up.https://github.com/uwblueprint/shoe-project/pull/337