Render Admin Providers with Server Side Props #7623
GeorgeHulpoi
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! Currently the CMS renders
admin.components.providers
with only one prop, thechildren
property. Therefore, it can be helpful when dealing with client-side features, but not with server-side.I want to propose to render the Providers similar with how other features are rendered (example:
admin.components.Field
). If it's a server-side component, pass in args thereq
andpayload
. It already seems like inRootLayout
there is thereq
,payload
anduser
inpayload/packages/next/src/layouts/Root/index.tsx
Lines 56 to 70 in 59eecc4
Therefore in
payload/packages/ui/src/providers/ComponentMap/buildComponentMap/index.tsx
Lines 71 to 81 in fa3d250
WithServerSidePropsGeneric
. Also, it would be great to have access to theuser
prop.Why this approach? Using providers can be very helpful on server-side to create guards, but the current approach forces the developer to make it on client-side. And on the client-side can be a delay between the first-render and the provider execution.
Beta Was this translation helpful? Give feedback.
All reactions