fix(useLocal): depuración de localStorage — groupOrder y categoryAssignments (#78)#87
Merged
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors the Zustand local storage store to stop persisting ephemeral drag-and-drop ordering data and to remove an unused category assignment field and its hooks, while explicitly whitelisting which fields are serialized to localStorage. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
partializeimplementation is now the single source of truth for what gets persisted; consider using object destructuring (e.g.,const { serverHost, tutorialsSeen, ... } = state) or a typed helper to reduce the risk of forgetting to include new fields when they should be persisted.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `partialize` implementation is now the single source of truth for what gets persisted; consider using object destructuring (e.g., `const { serverHost, tutorialsSeen, ... } = state`) or a typed helper to reduce the risk of forgetting to include new fields when they should be persisted.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR updates the renderer’s local Zustand store persistence to avoid accumulating stale session-specific data in localStorage, and removes unused state that had no call sites.
Changes:
- Add
partializeto thepersistconfig so only stable config fields are saved (serverHost,tutorialsSeen,excludedTags,excludedWords). - Remove
categoryAssignmentsand its setter from the store and exported hooks. - Keep
groupOrderin-memory only (no longer persisted) to prevent cross-session staleness.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
49
to
+57
| name: "local-storage", | ||
| // groupOrder holds canonical UUIDs regenerated each session, so | ||
| // persisting it would only accumulate stale data across sessions. | ||
| partialize: (state) => ({ | ||
| serverHost: state.serverHost, | ||
| tutorialsSeen: state.tutorialsSeen, | ||
| excludedTags: state.excludedTags, | ||
| excludedWords: state.excludedWords, | ||
| }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
El store de Zustand persistía en
localStoragedos campos que acumulaban datos indefinidamente entre sesiones:groupOrderalmacena el orden de drag-and-drop del label manager comoRecord<category, canonicalId[]>. LoscanonicalIdson UUIDs generados frescos cada vez que se procesan archivos, por lo que cualquier entrada de una sesión anterior es basura garantizada. Se excluye de la persistencia viapartialize; sigue funcionando en RAM durante la sesión.categoryAssignmentsera dead code:setCategoryAssignmentsnunca fue invocado en ningún call site. Se elimina completamente del store y sus hooks.Cambios:
partializeal config depersistpara serializar soloserverHost,tutorialsSeen,excludedTagsyexcludedWords.categoryAssignments/setCategoryAssignmentsdel tipo, la implementación y los hooks exportados.Cierra #78.
Summary by Sourcery
Restrict persisted Zustand local storage state to stable configuration fields and remove unused category assignment state from the local store and related hooks.
Bug Fixes:
Enhancements: