Skip to content

fix(console): guard tablesdb column/index tabs when no table is selected - #15072

Merged
ChiragAgg5k merged 255 commits into
mainfrom
cursor/fix-console-v4-1rc-columns-guard-d482
Oct 29, 2026
Merged

ChiragAgg5k merged 255 commits into
mainfrom
cursor/fix-console-v4-1rc-columns-guard-d482

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

TablesDB Workspace rendered ColumnsSpreadsheet and IndexesSpreadsheet whenever activeTab was columns or indexes, even when selectedTable was undefined (for example while table detail is still loading, or when no table is selected). ColumnsSpreadsheet reads table.$id on mount, which caused TypeError: Cannot read properties of undefined (reading '$id') (Sentry CONSOLE-V4-1RC).

DocumentsDB and VectorsDB already guard these tabs with selectedTable; the rows and documents tabs in TablesDB did as well. This change applies the same guard to columns and indexes.

Test plan

  • bun test tests/unit/tablesdb-workspace-columns-tab-guard.test.ts

Fixes CONSOLE-V4-1RC

Open in Web Open in Cursor 

Related: appwrite-labs/cloud#5938

@luxor-code-review

luxor-code-review Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 2 nitpicks below.

🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 Source-text assertions make tablesdb guard test brittle (tablesdb-workspace-columns-tab-guard.test.ts:24) — The new regression test pins the guard by matching raw source text of Workspace.tsx, including exact JSX strings from documentsdb/Workspace.tsx (apps/console/tests/unit/tablesdb-workspace-columns-tab-guard.test.ts:27-28), so any unrelated reformat, quote-style change, or rename in documentsdb fails the tablesdb test, and readFileSync throws if that file moves.
  • 🟢 Negative regexes catch only one formatting (tablesdb-workspace-columns-tab-guard.test.ts:33) — The negative assertions at tablesdb-workspace-columns-tab-guard.test.ts:33-38 fail only if the unguarded render is written exactly as {activeTab === 'columns' && ( followed by a newline and the component tag.

This PR fixes the columns/indexes tab crash when no table is selected in the tablesdb workspace, mirroring the documentsdb guard, and adds a regression test that pins the guard via raw source-text matching.

Files Change
apps/console/src/components/pages/projects/$projectId/databases/tablesdb/Workspace.tsx Wraps the columns and indexes spreadsheet renders in a selectedTable guard so they no longer mount without a table.
apps/console/tests/unit/tablesdb-workspace-columns-tab-guard.test.ts Adds a string-matching unit test asserting the guard exists in both tablesdb and documentsdb workspaces.

The guard change is consistent with the existing documentsdb and vectorsdb patterns. Two low-severity review comments target the test's fragility: it asserts exact source text across an unrelated file, and its negative regexes match only one formatting of the unguarded pattern.

Reviewed commit: 5dc90a3

@appwrite

appwrite Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

New Console

Project ID: new-console

Sites (1)
Site Status Logs Preview QR
 New Console
new-console
Ready Ready View Logs Preview URL QR Code

Tip

Roll back Sites deployments instantly by switching between versions

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 28, 2026
@ghost

ghost commented Oct 28, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

TablesDB Workspace now mounts the columns and indexes spreadsheets only when a table is selected. The pull request adds regression tests for loading and selected-table states, the required DOM/testing-library dependencies, and updated type-baseline entries.

Latest changes: The newest commit removes the test-only translation mock so the regression test uses the actual i18n implementation.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 5
File Change
apps/console/bun.lock Locks the DOM and React Testing Library dependencies used by the new regression test.
apps/console/package.json Adds test-only DOM and React Testing Library dependencies.
apps/console/src/components/pages/projects/$projectId/databases/tablesdb/Workspace.tsx Guards columns and indexes spreadsheet rendering on table selection.
apps/console/tests/unit/tablesdb-workspace-columns-tab-guard.test.tsx Adds loading and selected-table render coverage; the latest commit removes the translation mock.
apps/console/types-baseline.json Removes two previously recorded Collection-or-undefined type errors.

Reviewed the commits since 2c36cdd · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · See the inline comments. Summary

Comment thread apps/console/package.json Resolved
Comment thread apps/console/bun.lock Resolved

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · See the inline comments. Summary

Comment thread apps/console/types-baseline.json Resolved

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · See the inline comments. Summary

@ChiragAgg5k

Copy link
Copy Markdown
Member Author

@hansi-codes review

@ghost
ghost dismissed their stale review October 29, 2026 10:41

The findings that requested changes are resolved. See the summary comment for what is still open.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

bun's mock.module is process-wide and mock.restore() does not undo it, so the
identity translateText mock leaked into i18n-dictionaries-load.test.ts and
failed 'hebrew translates after the dictionary chunk loads' in CI. Workspace
renders fine with the real translator (English passthrough).
@ChiragAgg5k
ChiragAgg5k merged commit bc836c5 into main Oct 29, 2026
34 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the cursor/fix-console-v4-1rc-columns-guard-d482 branch October 29, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants