Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
@aadityabhusal is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThis PR adds ChangesTable metadata invalidation consolidation
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This change localizes table metadata cache invalidation across table editing flows, with no actionable merge-blocking risk remaining beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
apps/studio/data/database-queues/database-queues-create-mutation.ts (1)
78-84: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueBatch the two independent invalidations with
Promise.allfor consistency.All sibling mutation files (table-create, table-delete, column-delete) wrap their invalidations in
Promise.all; this one awaits them sequentially, adding avoidable latency and diverging from the pattern used elsewhere in this PR.♻️ Proposed refactor
async onSuccess(data, variables, context) { const { projectRef, name } = variables - await queryClient.invalidateQueries({ queryKey: databaseQueuesKeys.list(projectRef) }) - await invalidateTableMetadata(queryClient, { - projectRef, - schema: 'pgmq', - tableName: pgmqQueueTable(name), - }) + await Promise.all([ + queryClient.invalidateQueries({ queryKey: databaseQueuesKeys.list(projectRef) }), + invalidateTableMetadata(queryClient, { + projectRef, + schema: 'pgmq', + tableName: pgmqQueueTable(name), + }), + ]) await onSuccess?.(data, variables, context) },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/data/database-queues/database-queues-create-mutation.ts` around lines 78 - 84, The invalidations in databaseQueuesCreateMutation are independent but are awaited sequentially; update the mutation handler to run queryClient.invalidateQueries and invalidateTableMetadata together with Promise.all for consistency with the sibling create/delete mutations. Keep the existing projectRef, name, databaseQueuesKeys.list, invalidateTableMetadata, and pgmqQueueTable references, but batch the two awaits so they execute in parallel.apps/studio/data/tables/table-metadata-invalidation.ts (1)
81-85: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueMove the
includeRowsinvalidation into the mainPromise.allfor consistency and parallelism.
includeLintis folded into the samePromise.allbatch, butincludeRowsis awaited separately afterward, unnecessarily serializing this call after everything else resolves.♻️ Proposed refactor
await Promise.all([ queryClient.invalidateQueries({ queryKey: tableKeys.names(projectRef) }), queryClient.invalidateQueries({ queryKey: entityTypeKeys.list(projectRef) }), queryClient.invalidateQueries({ queryKey: databaseKeys.tableColumnsPrefix(projectRef) }), ...(includeLint ? [queryClient.invalidateQueries({ queryKey: lintKeys.lint(projectRef) })] : []), + ...(includeRows && tableId !== undefined + ? [ + queryClient.invalidateQueries({ + queryKey: tableRowKeys.tableRowsAndCount(projectRef, tableId), + }), + ] + : []), ...(tableId === undefined ? [] : [ ]) - - if (includeRows && tableId !== undefined) { - await queryClient.invalidateQueries({ - queryKey: tableRowKeys.tableRowsAndCount(projectRef, tableId), - }) - } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/data/tables/table-metadata-invalidation.ts` around lines 81 - 85, The `includeRows` invalidation is still awaited separately in `invalidateTableMetadata`, which serializes it after the rest of the work; move this `queryClient.invalidateQueries` call into the same `Promise.all` batch used for the other invalidations, alongside the existing `includeLint` handling, while keeping the `tableRowKeys.tableRowsAndCount` lookup guarded by `includeRows && tableId !== undefined`.apps/studio/data/database/keys.ts (1)
48-49: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueOmit the trailing
schemaslot when it isn’t provided.foreignKeyConstraintsPrefix(projectRef)currently produces['projects', projectRef, 'foreign-key-constraints', undefined], which won’t match schema-specific keys if this helper is ever called without a schema. Match the conditional tuple shape used bytableColumnsPrefix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/data/database/keys.ts` around lines 48 - 49, Update foreignKeyConstraintsPrefix in database/keys so it matches the conditional tuple pattern used by tableColumnsPrefix: when schema is provided, include it in the returned key, and when it is omitted, return the shorter tuple without an undefined trailing slot. This helper should only append schema conditionally so callers of foreignKeyConstraintsPrefix(projectRef) produce the same key shape as the corresponding schema-specific entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx`:
- Around line 424-430: The column-save invalidation path in SidePanelEditor is
refreshing row metadata but not lint data, which can leave lint views stale
after schema-affecting column edits. Update the invalidateTableMetadata call in
SidePanelEditor to include includeLint: true for column changes, matching the
table create/update flows, while keeping the existing includeRows behavior and
using the selectedTable/project identifiers already present.
In `@apps/studio/data/tables/table-metadata-invalidation.ts`:
- Line 50: The table-columns invalidation in the table metadata helper is too
broad because databaseKeys.tableColumnsPrefix(projectRef) refreshes every table
in the project. Update the invalidation logic in table-metadata-invalidation.ts
to use the available schema and tableName inputs and target only the affected
table’s query key, keeping the change localized in the existing invalidation
helper that calls queryClient.invalidateQueries.
---
Nitpick comments:
In `@apps/studio/data/database-queues/database-queues-create-mutation.ts`:
- Around line 78-84: The invalidations in databaseQueuesCreateMutation are
independent but are awaited sequentially; update the mutation handler to run
queryClient.invalidateQueries and invalidateTableMetadata together with
Promise.all for consistency with the sibling create/delete mutations. Keep the
existing projectRef, name, databaseQueuesKeys.list, invalidateTableMetadata, and
pgmqQueueTable references, but batch the two awaits so they execute in parallel.
In `@apps/studio/data/database/keys.ts`:
- Around line 48-49: Update foreignKeyConstraintsPrefix in database/keys so it
matches the conditional tuple pattern used by tableColumnsPrefix: when schema is
provided, include it in the returned key, and when it is omitted, return the
shorter tuple without an undefined trailing slot. This helper should only append
schema conditionally so callers of foreignKeyConstraintsPrefix(projectRef)
produce the same key shape as the corresponding schema-specific entries.
In `@apps/studio/data/tables/table-metadata-invalidation.ts`:
- Around line 81-85: The `includeRows` invalidation is still awaited separately
in `invalidateTableMetadata`, which serializes it after the rest of the work;
move this `queryClient.invalidateQueries` call into the same `Promise.all` batch
used for the other invalidations, alongside the existing `includeLint` handling,
while keeping the `tableRowKeys.tableRowsAndCount` lookup guarded by
`includeRows && tableId !== undefined`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0cc6fedf-c083-4f7e-93e1-ed1ef123c269
📒 Files selected for processing (10)
apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsxapps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsxapps/studio/data/database-columns/database-column-delete-mutation.tsapps/studio/data/database-queues/database-queues-create-mutation.tsapps/studio/data/database/keys.tsapps/studio/data/tables/table-create-mutation.tsapps/studio/data/tables/table-delete-mutation.tsapps/studio/data/tables/table-metadata-invalidation.tsapps/studio/data/tables/table-update-mutation.tsapps/studio/tests/data/tables/table-metadata-invalidation.test.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
awaseem
left a comment
There was a problem hiding this comment.
Hey thanks for the fix, things from end that you can check and validate please 🙏
diagnosis is right and I couldn't find any invalidation you'd dropped. The schema visualizer (infiniteListPrefix) and drawer constraints (tableConstraints) were the two that were actually stale, and both are covered now 🎉
One thing before merge: drop tableId from the create branch. createTableprefetches the new table's editor cache right before we navigate, and invalidating tableEditor/tableDefinition/tableConstraints for that same id throws it away, so we refetch on mount for no reason. A just-created table has nothing stale to invalidate by id anyway.
Also worth keeping the // invalidate tableRowsAndCount after tableEditor comment — the helper still honors the ordering, but nothing explains why anymore and someone will fold it into the Promise.all eventually.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
awaseem
left a comment
There was a problem hiding this comment.
Nice clean up, like the util methods a ton. merging
Braintrust eval report
|
…for-pitr-archiving-stale * origin/master: (65 commits) feat(studio): track assistant notebook divergence (#49539) Assistant notebook confirm button CTAs to have loading states (#49531) Remove box shadow on explorer home tab button (#49530) Show loader for notebook counts (#49529) Allow pasting multiple redirect URLs at once (#49490) feat(studio): warn on dirty notebook assistant proposals (#49536) docs(integrations): add Stripe Projects provisioning guide (#49354) fix(studio): stale table metadata cache invalidation after table edits (#47541) feat(studio): CLI deploy instructions for workers (FE-4191) (#49194) feat: update @supabase/*-js libraries to v2.112.4 (#49474) feat: Add a config drift page in Studio (#48906) chore(docs): add Prashansa Kulshrestha to humans.txt (#49522) chore: add Ping-Min Lin to humans.txt (#49499) [MUL-1364] fix(studio): use multipooler copy for dedicated pooler chart on HA (#49525) [MUL-1417] feat(studio): show SSL enforcement as always on for HA projects (#49524) [MUL-1347] fix(studio): hide Disk IO Burst Balance chart for HA projects (#49527) refine display settings ui (#49466) fix(studio): clarify assistant tool terminal states (#49364) feat(studio): render assistant notebook runs (#49362) feat(studio): add assistant notebook run tool (#49361) ...
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Fixes stale table metadata after saving edits from the table editor drawer.
Previously, metadata-only table changes, such as column updates, primary key/foreign key changes, table renames, or schema moves, could leave cached table data stale. This affected the Database tables list, schema visualizer, and reopening the edit drawer.
Fixes #47540
What is the new behavior?
Table metadata caches are now invalidated consistently after table create, update, delete, column delete, and queue table creation flows.
The Database tables list, schema visualizer, table editor drawer, table definitions, constraints, foreign keys, table columns, rows, and lint data now refresh correctly after relevant table metadata changes.
Additional context
Stale.Cache.Fix.mp4
Summary by CodeRabbit
New Features
Bug Fixes
Tests