Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't revalidate user data when editing #181

Open
nicholaschiang opened this issue May 11, 2021 · 1 comment
Open

Don't revalidate user data when editing #181

nicholaschiang opened this issue May 11, 2021 · 1 comment
Labels
p1 Urgent tasks story:org-onboarding Orgs can onboard, vet, and manage volunteer profiles type:bug Something isn't working in a story

Comments

@nicholaschiang
Copy link
Member

To reproduce issue:

  1. First make sure you're an org admin (add your ID to the org members field in the local Firestore emulator).
  2. Open up http://localhost:3000/users/volunteer/edit.
  3. Make a change but don't click the "update user" button.
  4. Switch tabs or windows.
  5. Refocus the edit user tab and notice how your changes get reset.

If you open up developer tools, you should be able to see an HTTP request that is sent when you refocus the edit user tab. This is because the pages/[org]/users/[id]/edit.tsx page uses SWR which automatically revalidates data when a page regains focus.

Instead, you should disable SWR's automatic revalidation only if the user's data has been changed in the front-end but not yet updated in the back-end (i.e. if the user data has been changed but the "update user" button has yet to be clicked).

You can look for examples of how to implement this pattern in components/calendar/index.tsx which prevents revalidation while there are meetings that have been mutated.

@nicholaschiang nicholaschiang added type:bug Something isn't working in a story p1 Urgent tasks story:org-onboarding Orgs can onboard, vet, and manage volunteer profiles labels May 11, 2021
nicholaschiang added a commit that referenced this issue May 16, 2021
@nicholaschiang
Copy link
Member Author

Because of #213, this issue will only affect people who try to update their profiles from the org signup page (/[org]/signup) instead of the profile page (/profile). Thus, this is still quite a high priority issue (related: nicholaschiang/hammock#27).

nicholaschiang added a commit that referenced this issue May 16, 2021
Temporary fix for #181 that clears any edits on the signup page due to
SWR revalidating the global user object. Instead of allowing users to
edit their profiles directly on the org signup page, TB now just
redirects them to their profile pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 Urgent tasks story:org-onboarding Orgs can onboard, vet, and manage volunteer profiles type:bug Something isn't working in a story
Projects
None yet
Development

No branches or pull requests

1 participant