mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 07:09:07 +03:00
intialization issue
This commit is contained in:
1 parent
f2d53d1008
commit
7585609510
3 files changed
+13
-13
No files matched your search
@@ -356,7 +356,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
|
||||
data={projectSnippetsTreeState}
|
||||
aria-label="project-level-snippets"
|
||||
nodeRenderer={({ element, ...props }) => {
|
||||
const tabsStore = getTabsStore(projectRef as string)
|
||||
const tabsStore = getTabsStore(projectRef)
|
||||
const isOpened = Object.values(tabsStore.tabsMap).some(
|
||||
(tab) => tab.metadata?.sqlId === element.id || tab.id === element.id
|
||||
)
|
||||
@@ -421,7 +421,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
|
||||
data={favoritesTreeState}
|
||||
aria-label="favorite-snippets"
|
||||
nodeRenderer={({ element, ...props }) => {
|
||||
const tabsStore = getTabsStore(projectRef as string)
|
||||
const tabsStore = getTabsStore(projectRef)
|
||||
const isOpened = Object.values(tabsStore.tabsMap).some(
|
||||
(tab) => tab.metadata?.sqlId === element.id || tab.id === element.id
|
||||
)
|
||||
@@ -532,7 +532,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
|
||||
aria-label="private-snippets"
|
||||
expandedIds={defaultExpandedFolderIds}
|
||||
nodeRenderer={({ element, ...props }) => {
|
||||
const tabsStore = getTabsStore(projectRef as string)
|
||||
const tabsStore = getTabsStore(projectRef)
|
||||
const isOpened = Object.values(tabsStore.tabsMap).some(
|
||||
(tab) => tab.metadata?.sqlId === element.id || tab.id === element.id
|
||||
)
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { useRouter } from 'next/router'
|
||||
import { useParams } from 'common'
|
||||
import { SchemaGraph } from 'components/interfaces/Database/Schemas/SchemaGraph'
|
||||
import { ExplorerLayout } from 'components/layouts/explorer/layout'
|
||||
import { ReactFlowProvider } from 'reactflow'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
import { getTabsStore, addTab } from 'state/tabs'
|
||||
import { useEffect } from 'react'
|
||||
import { FileJson2 } from 'lucide-react'
|
||||
import { ProjectContextFromParamsProvider } from 'components/layouts/ProjectLayout/ProjectContext'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect } from 'react'
|
||||
import { ReactFlowProvider } from 'reactflow'
|
||||
import { addTab, getTabsStore } from 'state/tabs'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
|
||||
const SchemasPage: NextPageWithLayout = () => {
|
||||
const router = useRouter()
|
||||
const { ref } = useParams()
|
||||
const schema = router.query.schema as string
|
||||
const store = getTabsStore('explorer')
|
||||
const store = getTabsStore(ref)
|
||||
|
||||
useEffect(() => {
|
||||
if (schema) {
|
||||
|
||||
@@ -45,11 +45,10 @@ export const tabsStore = proxy<TabsStateMap>({})
|
||||
|
||||
// Helper to get/create state for a specific ref
|
||||
export const getTabsStore = (ref: string | undefined): TabsState => {
|
||||
if (!ref) return defaultState
|
||||
if (!ref) return proxy(defaultState)
|
||||
if (!tabsStore[ref]) {
|
||||
// Load from localStorage or use default
|
||||
const stored = localStorage.getItem(getStorageKey(ref))
|
||||
tabsStore[ref] = stored ? JSON.parse(stored) : defaultState
|
||||
tabsStore[ref] = proxy(stored ? JSON.parse(stored) : { ...defaultState })
|
||||
}
|
||||
return tabsStore[ref]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user