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

use url instead of localstorage #651

Merged
merged 2 commits into from
Dec 2, 2024
Merged

use url instead of localstorage #651

merged 2 commits into from
Dec 2, 2024

Conversation

martincai8
Copy link
Contributor

@martincai8 martincai8 commented Dec 1, 2024

Ticket: https://www.notion.so/nwplus/Investigate-localstorage-overwrite-14e14d529faa809f8043f9717d4e0b20

Description

  • nuked localstorage in favour of reading the state from the url to create an independent single source of truth (solves the issue of localstorage values persisting through different tabs)
  • simplified activeHackathon and dbHackathonName to be derived values instead of managed states

The idea is that whenever the url changes:

  • useLocation() triggers a re-render of HackathonProvider
  • urlHackathon is recalculated from the new URL
  • activeHackathon gets derived from urlHackathon and dbHackathonName is derived from activeHackathon

Testing

  • navigate through different pages, change the url, etc.
  • testing the workflow that made things glitchy:
    • fill out an application for hackcamp
    • go to the dev firebase db and give yourself a status of acceptedAndAttending
    • delete your applicant object from nwHacks2025/Applicants if you already have an existing application
    • from the application page (/app/hackcamp/application), navigate to app/nwhacks/application/part-1 by changing the url manually
    • check the nwHacks2025/Applicants collection to see if you have a new blank object (previously, your application from hackcamp would be copied over)

Copy link

github-actions bot commented Dec 1, 2024

Visit the preview URL for this PR (updated for commit 88014b2):

https://nwplus-ubc--pr651-martin-bye-localstor-qqvhynxq.web.app

(expires Sun, 08 Dec 2024 01:22:44 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 8c7ea898e009e43455645bc310bcbccfc0f87e48

@martincai8 martincai8 marked this pull request as ready for review December 1, 2024 01:28
@martincai8 martincai8 merged commit 0c6140d into dev Dec 2, 2024
2 checks passed
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.

3 participants