Skip to content

Commit

Permalink
fix OpaqueAspects bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GAOChengzhan committed Dec 12, 2024
1 parent cabf4f2 commit 098d531
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/store/persist/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 708,7 @@ export const putOpaqueAspectsToDb = async (

export const getOpaqueAspectsFromDb = async (
networkId: IdType,
): Promise<Record<string, any[]> | undefined> => {
): Promise< any[] | undefined> => {
return await db.opaqueAspects.get({ id: networkId })
}

Expand Down
3 changes: 3 additions & 0 deletions src/utils/cx-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ import {
getNetworkViewsFromDb,
getVisualStyleFromDb,
getUiStateFromDb,
getOpaqueAspectsFromDb,
} from '../store/persist/db'
import { CachedData } from './CachedData'
import { createNetworkAttributesFromCx } from '../models/TableModel/impl/NetworkAttributesImpl'
Expand Down Expand Up @@ -72,13 73,15 @@ export const getCachedData = async (id: string): Promise<CachedData> => {
uiState?.visualStyleOptions ?? {}
// Fall back to an empty object if the visual style options are not found
const visualStyleOptions: VisualStyleOptions = vsOptions[id] ?? {}
const otherAspects: any[] | undefined = await getOpaqueAspectsFromDb(id)
return {
network,
visualStyle,
nodeTable: tables !== undefined ? tables.nodeTable : undefined,
edgeTable: tables !== undefined ? tables.edgeTable : undefined,
networkViews: networkViews ?? [],
visualStyleOptions: visualStyleOptions,
otherAspects: otherAspects,
}
} catch (e) {
console.error('Failed to restore data from IndexedDB', e)
Expand Down

0 comments on commit 098d531

Please sign in to comment.