feat(boards): cache named board data with tag-based invalidation#5737
Open
ajnart wants to merge 4 commits into
Open
feat(boards): cache named board data with tag-based invalidation#5737ajnart wants to merge 4 commits into
ajnart wants to merge 4 commits into
Conversation
Board fetch + auth() now run concurrently via Promise.all instead of sequentially. Widget prefetches for all kinds also run in parallel alongside integration permission loading.
Named boards are now served from Next.js unstable_cache (1h TTL,
tag `board-{name}`). A new `getSharedBoardWithWhereAsync` helper
fetches the board without per-user data so the result is safe to
share across requests.
Cache is busted via `invalidateBoardCacheAsync` (revalidateTag +
revalidatePath) from board save, layout save, and partial settings
mutations.
- Run prettier on all modified files - Add required cache profile arg to revalidateTag - Suppress require-await for server action (must be async)
Dokploy Preview Deployment
|
manuel-rw
previously approved these changes
May 18, 2026
Member
manuel-rw
left a comment
There was a problem hiding this comment.
this looks good to me, but wait for @Meierschlumpf 's approval.
What consequences does this have, when the cache is outdated? Does it cause race conditions when saving?
Meierschlumpf
previously requested changes
May 24, 2026
Member
There was a problem hiding this comment.
Based on my understanding these changes will result in a few problems:
- User specific data is no longer delivered, so groups / permissions of the user and collapse states will no longer be available.
- at least if the⚠️ Anybody can access even private boards as there no longer is athrowIfActionForbiddenAsyncwithviewpermission_layout-creatorwould not check for it additionally. You could consider caching the values from getInitialBoard for the specific request so it does not send 3 calls to that function (layout, page and metadata) instead and maybe also improve thethrowIfActionForbiddenAsyncwhich is currently also sending db requests for info that could be available through the requested board
The unstable_cache approach bypassed throwIfActionForbiddenAsync and dropped user-specific data (permissions, collapse states). Use React cache() to deduplicate getInitialBoard within a single request instead, preserving auth checks and all user data while reducing DB calls from 9 to 3 per board page load.
Member
Author
I replaced the unstable_cache approach with React cache() for per-request deduplication. Layout, page, and metadata now share one tRPC call (3 DB queries instead of 9), while keeping the full auth check and all user-specific data intact |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getSharedBoardWithWhereAsync— fetches board structure without per-user data (permissions, collapse states), safe to cache across requestsunstable_cachewith a 1h TTL andboard-{name}taginvalidateBoardCacheAsyncserver action that busts cache on board save, layout save, and partial settings mutationsgetHomeBoard)Depends on #5736.
Test plan