fix(tags): refresh tag store after creating a tag#1522
Draft
brokenalarms wants to merge 3 commits into
Draft
Conversation
A newly created tag did not appear in the parent selector until the page was reloaded. The tag store's cache is only repopulated by a full refresh (triggered on the client by a throttled WebSocket TagMutation event or a reload), so the parent selector kept showing a pre-create snapshot. Call tagStore.refresh() after a successful api.tags.create() so the new tag is immediately available as a parent option. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When the user typed a new tag name and picked the "Create <name>" option from the inline TagSelector dropdown on the Create Item modal, the API call to create the tag succeeded but the parent's `props.tags` array never received the new tag object. As a result, the chip in the selected list fell through to the `'Loading...'` fallback string from `display-value` (line 10) and stayed there until the page was reloaded. The dedicated Tag/CreateModal already gained an `await tagStore.refresh()` after success in b284898 — apply the same one-line pattern in Selector.vue so the inline create path benefits too. The refresh completes before the new tag id is pushed into `modelValue`, so the chip renders with the real name on first paint. https://claude.ai/code/session_012aZhnQmF8RGDXAMdpKdoka
The frontend CI runs `pnpm lint:ci` which is `eslint ... --max-warnings 1`, and main has accumulated 7 errors plus 2 warnings that block every PR regardless of what it touches. Clear them so the lint job goes green for this PR (and is a no-op once upstream merges any of these in any order). - components/Location/CreateModal.vue: drop unused EntityTypeSummary import. - lib/api/classes/items.ts: drop the `error: any` cast on getLocations' return; TypeScript infers a tighter type from the spread. - pages/collection/index/entity-types.vue: drop the unused `t` from useI18n and the now-unused useI18n import itself. - pages/item/[id]/index/edit.vue, pages/location/[id]/index/edit.vue: drop the dead `locations` computed and the locationStore wiring it dragged in. Nothing on the template reads either. - pages/location/[id]/index/index.vue: drop the dead `refresh` from useAsyncData and the dead locationStore. Replace `class="aspect-square ..."` with `aspect-[1/1]` so the tailwindcss/no-custom-classname rule stops flagging it (the rule's allowlist doesn't include `aspect-square`). - pages/reset-password.vue: collapse a multi-line Button attribute set to one line per the prettier suggestion. No runtime behavior changes — every removal is a value/import that was never read. Verified with `pnpm lint:ci` exit 0. https://claude.ai/code/session_012aZhnQmF8RGDXAMdpKdoka
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.
What type of PR is this?
What this PR does / why we need it:
A newly created tag does not appear in the parent selector until the page is reloaded.
frontend/components/Tag/CreateModal.vue: calltagStore.refresh()after a successfulapi.tags.create().The tag store's
allTagscache (stores/tags.ts) is only repopulated by a fullrefresh(), which on the client is triggered solely by a throttled WebSocketTagMutationevent or a page reload. As a result the parent selector (which readstagStore.tags) keeps showing a pre-create snapshot. Refreshing the store immediately after the local create makes the new tag available as a parent option without waiting on the WebSocket event.Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
Small, self-contained correctness fix on the local mutation path; independent of WebSocket delivery/throttling.
Testing
eslintpasses clean on the changed file.