You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support scoped server loaders for nested Pages layouts #882
Our admin layout displays an unread-report count shared by several nested pages. Middleware reads it before each request and puts it in shared. When a page action marks a report as read, the action’s page response still contains the pre-action count unless the handler refreshes it explicitly. Each action that changes the count has to know about the sidebar, and the admin-only field appears in the application-wide shared type.
What I checked
In a four-file React Pages fixture with void@1.11.0, I ran the installed page scanner with these files:
The page entry recorded serverPath: "admin/index.server.ts" and methods: ["loader"]. The layout entry recorded its directory and component path only. The Pages actions guide also documents that middleware does not run a second time when the action rerenders the page.
Request
Let a layout supply a server loader, for example through pages/admin/layout.server.ts, and expose the inferred result to that layout. Run it for requests that render a descendant page, including a page refresh after an action, so its data reflects the completed mutation. Pages outside that layout should incur no read. For the sidebar case this would let the layout own its count and let each page action own its mutation.
The existing workaround is to recompute the shared field in the action before returning, or redirect to make a fresh request.
Activity