mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## Context Taking a slightly different approach to [this PR](https://github.com/supabase/supabase/pull/43370) Original problem was that if you opened some folders while in a bucket and then switched to a different bucket, the folder UI will persists (folders from Bucket A will render when landing on Bucket B) ## Changes involved - Shift `StorageExplorerStateContextProvider` into `[bucketId].tsx]` instead of `ProjectContext` - The valtio store here only applies for the storage explorer so having it so high in the project's context was unnecessary - This also just implies that the valtio store will automatically reset whenever the bucket changes - Simplify storage explorer valtio store by initializing the store with the bucket - We'll initialize the selected bucket with the store now (Same as previous PR) - Removes unnecessary `setSelectedBucket` method which required a separate `useEffect` in `StorageExplorer.tsx` ## To test - [ ] Verify that the original is resolved - [ ] General smoke test of the storage explorer - i've also re-added the e2e test that Gildas wrote up in his PR
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { PropsWithChildren } from 'react'
|
|
|
|
import { DatabaseSelectorStateContextProvider } from '@/state/database-selector'
|
|
import { RoleImpersonationStateContextProvider } from '@/state/role-impersonation-state'
|
|
import { StorageExplorerStateContextProvider } from '@/state/storage-explorer'
|
|
import { TableEditorStateContextProvider } from '@/state/table-editor'
|
|
import { TabsStateContextProvider } from '@/state/tabs'
|
|
|
|
type ProjectContextProviderProps = {
|
|
projectRef: string | undefined
|
|
}
|
|
|
|
export const ProjectContextProvider = ({
|
|
projectRef,
|
|
children,
|
|
}: PropsWithChildren<ProjectContextProviderProps>) => {
|
|
return (
|
|
<TableEditorStateContextProvider key={`table-editor-state-${projectRef}`}>
|
|
<TabsStateContextProvider key={`tabs-state-${projectRef}`}>
|
|
<DatabaseSelectorStateContextProvider key={`database-selector-state-${projectRef}`}>
|
|
<RoleImpersonationStateContextProvider key={`role-impersonation-state-${projectRef}`}>
|
|
{children}
|
|
</RoleImpersonationStateContextProvider>
|
|
</DatabaseSelectorStateContextProvider>
|
|
</TabsStateContextProvider>
|
|
</TableEditorStateContextProvider>
|
|
)
|
|
}
|