Skip to content

🔧 Fix Code Quality: currentUser read from queryClient cache directly instead of via hook#3

Open
manos-saratsis wants to merge 1 commit into
masterfrom
orchestrai/fix-code_quality-1772145800799
Open

🔧 Fix Code Quality: currentUser read from queryClient cache directly instead of via hook#3
manos-saratsis wants to merge 1 commit into
masterfrom
orchestrai/fix-code_quality-1772145800799

Conversation

@manos-saratsis

Copy link
Copy Markdown
Owner

Issue Fixed

Type: Code Quality
File: frontend/src/routes/_layout/admin.tsx
Line: 37

Description

Using queryClient.getQueryData<UserPublic>(['currentUser']) is fragile — if the cache key changes or the data hasn't been fetched yet, this silently returns undefined. There is no re-render trigger if the data loads after mount.

Suggested Fix

Use useQuery({ queryKey: ['currentUser'], ... }) with a proper queryFn, or create a useCurrentUser() hook that wraps useQuery, consistent with the rest of the app's data-fetching pattern.

Changes Made

  • Applied AI-generated fix to resolve the issue
  • Preserved existing code structure and style

Generated by OrchestrAI Software Engineer

…tly instead of via hook

File: frontend/src/routes/_layout/admin.tsx
Using `queryClient.getQueryData<UserPublic>(['currentUser'])` is fragile — if the cache key changes or the data hasn't been fetched yet, this silently returns undefined. There is no re-render trigger if the data loads after mount.

Generated by OrchestrAI Code Fix
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.

1 participant