Repository navigation
feat(frontend): add model language switcher to Explorer page - #572
Merged
Merged
Conversation
Fidesnoella
force-pushed
the
feat/CORE-773-explorer-language-switcher
branch
from
October 5, 2026 09:04
a8cd6a3 to
6990511
Compare
…s and improve language selection logic
rav3n11
force-pushed
the
feat/CORE-773-explorer-language-switcher
branch
from
October 6, 2026 12:52
d8d1ed3 to
4484559
Compare
Comment on lines
+91
to
+98
| queries: expandedItems.map((item) => { | ||
| const queryKey = explorerChildrenQueryKey(modelId, item.id, language); | ||
| return { | ||
| queryKey, | ||
| queryFn: () => explorerService.getChildren(modelId as string, item, language), | ||
| enabled: !!modelId, | ||
| placeholderData: keepPreviousDataOnLanguageChange(queryKey), | ||
| }; |
There was a problem hiding this comment.
Bug: The placeholderData function used with useQueries will not work as expected because useQueries doesn't provide the necessary arguments, causing a loading state on language change.
Severity: LOW
Suggested Fix
Refactor the implementation to align with TanStack Query's documented behavior for useQueries. Since useQueries does not pass previousQuery to the placeholderData function, consider an alternative approach to preserve data during language changes. This might involve using a different TanStack Query feature or managing the placeholder data state outside of the placeholderData function for this specific hook.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: frontend/src/explorer/useExplorerQueries.ts#L91-L98
Potential issue: The `useExplorerChildren` hook uses `useQueries` from TanStack Query
with a `placeholderData` function that expects `previousQuery` and `previousData`
arguments. According to the library's documentation, `useQueries` does not pass these
arguments, unlike `useQuery`. As a result, when a user with expanded explorer nodes
changes the application language, the `placeholderData` function returns `undefined`.
This causes the expanded nodes to revert to a loading state instead of preserving the
previous data until the new data is fetched, leading to a flickering UI and a degraded
user experience.
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.
Ticket: CORE-773