Skip to content

feat(frontend): add model language switcher to Explorer page - #572

Merged
rav3n11 merged 4 commits into
mainfrom
feat/CORE-773-explorer-language-switcher
Oct 6, 2026
Merged

rav3n11 merged 4 commits into
mainfrom
feat/CORE-773-explorer-language-switcher

Conversation

@Fidesnoella

@Fidesnoella Fidesnoella commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Ticket: CORE-773

Comment thread frontend/src/explorer/ExplorerPage.tsx Outdated
@Fidesnoella
Fidesnoella force-pushed the feat/CORE-773-explorer-language-switcher branch from a8cd6a3 to 6990511 Compare October 5, 2026 09:04
Comment thread frontend/src/explorer/ExplorerPage.tsx
@rav3n11
rav3n11 force-pushed the feat/CORE-773-explorer-language-switcher branch from d8d1ed3 to 4484559 Compare October 6, 2026 12:52
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),
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rav3n11
rav3n11 merged commit b39be96 into main Oct 6, 2026
13 checks passed
@rav3n11
rav3n11 deleted the feat/CORE-773-explorer-language-switcher branch October 6, 2026 18:58
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.

2 participants