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

Hold åpen versjonsvelger #145

Merged
merged 30 commits into from
Mar 21, 2025
Merged

Hold åpen versjonsvelger #145

merged 30 commits into from
Mar 21, 2025

Conversation

bdahle
Copy link
Contributor

@bdahle bdahle commented Mar 19, 2025

Oppsummering av hva som er gjort

  • Implementert caching-mekanisme for å hindre at versjonsvelgeren forsvinner/oppdateres når en versjon velges
  • Optimalisert visning av tittel, URL og versjon ved å cache data som allerede er lastet
  • Lagt til en lukk-knapp i versjonsvelgeren

bdahle added 14 commits March 13, 2025 13:57
…ntroduce caching mechanism

- Replace localStorage usage with a caching system for version selector state.
- Update version selector to utilize cached state and handle component mounting.
- Enhance VersionSelector component to support onMount callback for caching rendered instances.
…onent

- Introduce content-specific caching for version selector state.
- Clear cache when content ID changes to ensure accurate state management.
- Update localStorage handling to use dynamic storage keys based on content ID.
- Update cache clearing logic to immediately clear previous content ID when it changes.
- Reset local cache state when content ID changes to ensure accurate version data.
- Add effect to reset search query in VersionSelector when input versions change.
- Replace local reference for previous content ID with a React ref to improve cache clearing logic.
- Ensure cache is cleared immediately when content ID changes, maintaining accurate version data.
- Preserve the isOpen state when resetting the local cache on content ID changes.
- Introduce a separate effect to handle data loading without affecting the panel state, ensuring accurate version data is maintained.
- Modify the rendering condition to display either the cached VersionSelector component or a new instance based on availability.
- Enhance clarity in the code by improving comments related to component rendering.
- Simplify version selection logic by consolidating URL update conditions.
- Ensure the selected version is set correctly based on available data, improving user experience with accurate URL states.
- Remove localStorage handling for version selector state to simplify state management.
- Streamline the component by eliminating unnecessary storage key logic and effects.
- Ensure the selected version is set correctly without persisting state across sessions.
…omponents

- Update cache handling to clear and reset based on content ID changes, ensuring accurate version data.
- Simplify the search query reset logic in VersionSelector when versions change, improving user experience.
- Streamline the useEffect hooks for better clarity and performance in both components.
- Simplify version ID and URL management logic to enhance clarity and performance.
- Consolidate useEffect dependencies for better data handling and state updates.
- Improve comments for better understanding of cache management and rendering logic.
@bdahle bdahle marked this pull request as ready for review March 20, 2025 11:14
@bdahle bdahle changed the title Keep open version selector 2 Hold åpen versjonsvelger Mar 20, 2025
@bdahle bdahle linked an issue Mar 20, 2025 that may be closed by this pull request
@bdahle bdahle merged commit 23a6a2f into main Mar 21, 2025
5 checks passed
@bdahle bdahle deleted the keep-open-version-selector-2 branch March 21, 2025 10:42
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.

Testing av arkivet: Beholde venstremenyen etter valg av versjon
2 participants