ENG-1968 Pre-check groups a node is already shared to in the Publish tab - #1353
ENG-1968 Pre-check groups a node is already shared to in the Publish tab#1353sid597 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6ef082961
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| context.spaceId, | ||
| groups.map((g) => g.id), | ||
| ); | ||
| setSelectedGroupIds( |
There was a problem hiding this comment.
Refresh prechecked groups when the dialog reopens
When the persistent Export component in ResultsView.tsx is closed and later reopened after its query results change, groupsLoaded is still true, so the effect returns before recalculating this selection. The group IDs automatically selected here therefore remain associated with the previous nodes; publishing the new results can unintentionally share them with those stale groups. Reset the loading/selection state on close or recompute the prechecked groups whenever publishableNodes changes.
Useful? React with 👍 / 👎.
| const publishedIdsByGroup = await getAllPublishedIdsByGroup( | ||
| client, | ||
| context.spaceId, | ||
| groups.map((g) => g.id), | ||
| ); |
There was a problem hiding this comment.
Limit or paginate the published-resource lookup
For a space/group combination with more than 1,000 ResourceAccess entries, this call receives only the first page because packages/database/supabase/config.toml sets max_rows = 1000, while getAllPublishedIdsByGroup neither paginates nor filters by the nodes being checked. An already-published node omitted from that page is therefore shown as unchecked. Query only the relevant node UIDs for this precheck or paginate until all matching rows have been read.
Useful? React with 👍 / 👎.
When the Publish tab loads groups, it now also fetches the already-published node ids per group and pre-checks each group that already contains every publishable node in the current selection (the many-nodes case: a group is only pre-checked when all selected nodes are shared to it).
Unchecking a pre-checked group does not unshare — publish remains additive; re-publishing an already-shared selection is a no-op upsert. Also exports the existing getAllPublishedIdsByGroup helper so the dialog can reuse it.