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

convert initialEvents to a function #1982

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Oct 16, 2023

Convert the initialEvents list into a function that returns the list of initial events for two advantages:

  1. Get new event objects for every call, avoids the weird .map((e) => ...e) to copy the list
  2. Call hydrateClientStorage each time to ensure that the local storage and cookie hydrate dict contains the most up to date value.

Fix #1979


Add a new app harness test simulating the login flow that reproduced this issue initial. Since some additional refactoring is coming around on_load and hydrate, I wanted to be sure this flow does not regress after it is fixed.

Ensure that hydrateClientStorage is being called fresh each time the page is
hydrated to allow recently set local storage / cookie vars to be sent to the
backend.

Fix #1979
Copy link
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@picklelo picklelo merged commit c3f5f34 into main Oct 17, 2023
36 checks passed
@masenf masenf deleted the masenf/rehydrate-local-storage branch October 18, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LocalStorage state variable not being read
2 participants