fix: hide CSV import on empty table when table is not editable#2534
Open
everettbu wants to merge 1 commit into
Open
fix: hide CSV import on empty table when table is not editable#2534everettbu wants to merge 1 commit into
everettbu wants to merge 1 commit into
Conversation
The empty table state in Grid.tsx was showing the "Import data from CSV" button and accepting drag-and-drop for all non-foreign-table entities, regardless of whether the table is actually editable. This allowed users to import CSV data into protected schema tables (e.g. auth.instances), views, materialized views, and tables where the user lacks edit permissions. The Header component already correctly gates the import option behind `snap.editable`, but the empty table view in Grid.tsx was missing this check. Fixes #41358
Contributor
🎭 Playwright Test ResultsDetails
Skipped testsFeatures › assistant.spec.ts › AI Assistant › Can send a message to the assistant and receive a response |
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.
Mirror of supabase/supabase#43857
Original author: mango766
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When a table is empty, the Table Editor shows an "Import data from CSV" button and accepts CSV drag-and-drop regardless of whether the table is actually editable. This means users can import data into:
auth.instances,auth.users)The
Headercomponent already correctly checkssnap.editablebefore showing the import button, but the empty-table view inGrid.tsxis missing this check.Related: #41358
What is the new behavior?
The empty table view now checks
snap.editablebefore:useCsvFileDropFor non-editable tables, the empty state just shows "This table is empty" without the import option — consistent with how the Header already hides the Insert dropdown for non-editable tables.
Additional context
This is a minimal fix (2 lines of logic changed) that reuses the same
snap.editableflag the Header already relies on. There was a previous attempt at this (#41362) but it went stale — this approach is simpler and follows the existing pattern in the codebase.