Skip to content

Revert "fix: storage view is not reset when switching buckets" - #43539

Merged
joshenlim merged 1 commit into
masterfrom
revert-43370-fe-2666-bug-with-storage-ui-wrong-contents-displayed-when-switching
Mar 9, 2026
Merged

joshenlim merged 1 commit into
masterfrom
revert-43370-fe-2666-bug-with-storage-ui-wrong-contents-displayed-when-switching

Conversation

@joshenlim

Copy link
Copy Markdown
Member

Reverts #43370

@joshenlim
joshenlim requested a review from a team as a code owner March 9, 2026 03:59
@vercel

vercel Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Mar 9, 2026 4:03am
studio-staging Ready Ready Preview, Comment Mar 9, 2026 4:03am
7 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Mar 9, 2026 4:03am
studio Ignored Ignored Mar 9, 2026 4:03am
design-system Skipped Skipped Mar 9, 2026 4:03am
docs Skipped Skipped Mar 9, 2026 4:03am
learn Skipped Skipped Mar 9, 2026 4:03am
ui-library Skipped Skipped Mar 9, 2026 4:03am
zone-www-dot-com Skipped Skipped Mar 9, 2026 4:03am

Request Review

@linear

linear Bot commented Mar 9, 2026

Copy link
Copy Markdown

@supabase

supabase Bot commented Mar 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Summary by CodeRabbit

  • Refactor

    • Improved internal routing parameter extraction and state management in the storage explorer component.
  • Tests

    • Consolidated and updated storage explorer test cases.

Walkthrough

The changes refactor the storage explorer's state management by removing the bucketId parameter from the createStorageExplorerState function and associated state initialization. The StorageExplorer component is updated to extract routing parameters via useParams and use the ref parameter instead of bucketId for project queries. Effect dependencies are adjusted to rely on bucket and projectRef instead of bucketId. Additionally, a test case that verified storage view reset when switching buckets is removed from the test suite.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/studio/state/storage-explorer.tsx (1)

1883-1908: ⚠️ Potential issue | 🔴 Critical

Reintroduces stale state when switching buckets.

This effect now only rebuilds the explorer store when the project changes, so bucket-scoped state (openedFolders, columns, selectedBucket) survives bucket-to-bucket navigation inside the same project. In apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx, fetchContents() still runs before openBucket(), which means the first fetch after navigating from something like bucket-a/folder-x to bucket-b can still use the old bucket/path state and render bucket A’s contents under bucket B. Please keep resetting the explorer on bucket changes, or clear the bucket-scoped fields before any fetch for the new bucket starts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/studio/state/storage-explorer.tsx` around lines 1883 - 1908, The effect
in storage-explorer.tsx only rebuilds state when the project changes, allowing
bucket-scoped state (openedFolders, columns, selectedBucket) to persist across
bucket navigation and cause fetchContents() in StorageExplorer.tsx to render old
bucket data; update the useEffect (or the logic that calls
createStorageExplorerState) to also respond to bucket changes by clearing
bucket-scoped fields: reset openedFolders, columns, and selectedBucket (or
recreate the explorer state) whenever the active bucket changes (ensure the
bucket identifier is included in the effect dependencies or trigger a state
reset before fetchContents/openBucket runs) so the explorer cannot reuse stale
bucket/path state during the first fetch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/studio/state/storage-explorer.tsx`:
- Around line 1883-1908: The effect in storage-explorer.tsx only rebuilds state
when the project changes, allowing bucket-scoped state (openedFolders, columns,
selectedBucket) to persist across bucket navigation and cause fetchContents() in
StorageExplorer.tsx to render old bucket data; update the useEffect (or the
logic that calls createStorageExplorerState) to also respond to bucket changes
by clearing bucket-scoped fields: reset openedFolders, columns, and
selectedBucket (or recreate the explorer state) whenever the active bucket
changes (ensure the bucket identifier is included in the effect dependencies or
trigger a state reset before fetchContents/openBucket runs) so the explorer
cannot reuse stale bucket/path state during the first fetch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 15ecf6c9-2a11-409c-a329-9753e16d9273

📥 Commits

Reviewing files that changed from the base of the PR and between ed46a5a and 9ae56e1.

📒 Files selected for processing (3)
  • apps/studio/components/interfaces/Storage/StorageExplorer/StorageExplorer.tsx
  • apps/studio/state/storage-explorer.tsx
  • e2e/studio/features/storage.spec.ts

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  151 passed
flaky  3 flaky
skipped  4 skipped

Details

stats  158 tests across 20 suites
duration  10 minutes, 8 seconds
commit  9ae56e1

Flaky tests

Features › database.spec.ts › Database › Schema Visualizer › actions works as expected
Features › index-advisor.spec.ts › Index Advisor › Enable Index Advisor › should enable Index Advisor via Database > Extensions page
Features › index-advisor.spec.ts › Index Advisor › Index Advisor Functionality › should create test table without indexes

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@joshenlim
joshenlim merged commit 4a173ee into master Mar 9, 2026
24 checks passed
@joshenlim
joshenlim deleted the revert-43370-fe-2666-bug-with-storage-ui-wrong-contents-displayed-when-switching branch March 9, 2026 04:17
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Braintrust eval report

Evals in progress... ⌛

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