Merge pull request #12954 from nocodb/nc-fix/ui-bug

fix: Lazy loaded component related issue
This commit is contained in:
Pranav C
2026-01-28 18:21:39 +05:30
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -45,7 +45,15 @@ const handleDownload = async (url: string) => {
const isExporting = ref(false)
const { sorts, nestedFilters, isLocked } = useSmartsheetStoreOrThrow()
/**
* This component is lazy loaded and might be initialized after the view is effectively unmounted.
* In that case, the store is not available anymore, so we need to provide a fallback to avoid a crash.
*/
const { sorts, nestedFilters, isLocked } = useSmartsheetStore() || {
sorts: ref([]),
nestedFilters: ref([]),
isLocked: ref(false),
}
const { isUIAllowed } = useRoles()
const exportFile = async (exportType: ExportTypes) => {

View File

@@ -272,7 +272,7 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
'smartsheet-store',
)
export { useProvideSmartsheetStore }
export { useProvideSmartsheetStore, useSmartsheetStore }
export function useSmartsheetStoreOrThrow() {
const state = useSmartsheetStore()