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

Add hash values to maintain tab between page loads #54

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

shobensack
Copy link
Contributor

Hey @Gobluebro, I thought it would be neat to set hash values in the url to land you on the correct tab each time you hit the site, rather than always defaulting to "Quests." The default remains "Quests" if no hash value is present, or the hash value is a bad value. Seems useful so you don't have to constantly switch tabs anytime you come back to the page (an issue I have frequently with an otherwise great web app!) Thanks!

@Gobluebro Gobluebro self-requested a review June 19, 2024 21:43
@Gobluebro Gobluebro added the enhancement New feature or request label Jun 19, 2024
@Gobluebro
Copy link
Owner

Thanks for your interest in the project.

I'd going to make some changes before pulling.

In the meantime, I do have a question. Are you saving the whole url when you are coming back to this page? I guess I'm confused on how you'd come back to it with the tab already in the URL. Maybe we should be storing the current tab in local storage so anytime you comeback to the page you can resume where you left off even if you don't have the url hash included.

@Gobluebro
Copy link
Owner

Another question, do we need to keep a history of what tabs you have been on? Currently this code will continue to update your browser history every time you click a new tab. I don't know what the benefit of that would be. I'm going to change it so the history doesn't update every time.

@shobensack
Copy link
Contributor Author

@Gobluebro So the use case is that I use the checklist on my phone, and switch between the checklist and the Elden Ring wiki a lot. When navigating back to the checklist browser tab in Chrome, sometimes the page reloads which drops you back off at the "Quest" checklist tab (iOS + Chrome, though I'm sure most mobile browsers do this, I think its a memory saving thing).

Yeah, that is a good point, I don't think its neccessary to store browser history entries at all, and makes much more sense to just store in local storage for anytime you come back to the checklist.

I just added a commit that uses local storage, instead of hash values.

@Gobluebro
Copy link
Owner

So when you switch back and forth from mobile to desktop, does your checklist state sync? It saves all of your progress through local storage, but I assumed that was localized per device.

If it is the case that chrome is syncing both phone and desktop local storage then this solution should work well

@shobensack
Copy link
Contributor Author

@Gobluebro Sorry, when I said iOS + Chrome, I meant I use it mobile only using Chrome on iOS.

Local storage is per device, as far as I know.

@Gobluebro
Copy link
Owner

Ah okay thanks you for clarifying

Removed "default" tab and made quests the default value
@Gobluebro
Copy link
Owner

I have a hook that does this local storage work for me. I replaced the default enum value and made quests the default value in the hook.

@Gobluebro Gobluebro merged commit caf3419 into Gobluebro:main Jun 20, 2024
1 check passed
@shobensack
Copy link
Contributor Author

@Gobluebro woohoo! Thanks for the awesome checklist!

@Gobluebro
Copy link
Owner

Thank you for the kind words and for helping make this website better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants