Skip to content

Conversation

david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Sep 19, 2022

Look at the diff with whitespace changes hidden!

Wrap all authenticated routes in an element-less Route with a loader that prefetches /session/me. That way we don't get the user's name popping in in the header as shown below.

The loader moves the loading time to before the page has loaded. This is likely not introducing any additional delay to the pageload because it runs in parallel to any other loaders that are already running at that time.

2022-09-19-user-pop-in

@vercel
Copy link

vercel bot commented Sep 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
console-ui-storybook ✅ Ready (Inspect) Visit Preview Sep 19, 2022 at 8:17PM (UTC)

apiQueryClient.prefetchQuery('organizationPolicyView', requireOrgParams(params)),
// used to resolve user names
apiQueryClient.prefetchQuery('userList'),
apiQueryClient.prefetchQuery('userList', {}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The {} is now required as a result of removing the ? from the params arg. This ensures the call matches the one it's prefetching for — if they don't match, then the call in the component will not reuse this data.

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