MCPcopy Create free account
hub / github.com/bytebase/bytebase / seedSheetStatement

Function seedSheetStatement

frontend/src/react/hooks/useSheetStatement.ts:40–55  ·  view source on GitHub ↗
(
  sheetName: string,
  getLocalSheet?: (name: string) => Sheet | undefined
)

Source from the content-addressed store, hash-verified

38 * can omit it.
39 */
40export const seedSheetStatement = (
41 sheetName: string,
42 getLocalSheet?: (name: string) => Sheet | undefined
43): SheetStatementSnapshot => {
44 if (!sheetName) {
45 return EMPTY_SNAPSHOT;
46 }
47 if (extractSheetUID(sheetName).startsWith("-")) {
48 const localSheet = getLocalSheet?.(sheetName);
49 return localSheet ? snapshotOfSheet(localSheet) : EMPTY_SNAPSHOT;
50 }
51 const cached = useAppStore.getState().getSheetByName(sheetName);
52 return cached
53 ? snapshotOfSheet(cached)
54 : { statement: "", isLoading: true, isTruncated: false };
55};
56
57/**
58 * Load a sheet's statement without the first-paint "No data" flash. State is

Callers 7

loadFunction · 0.90
OptionsSectionFunction · 0.90
loadFunction · 0.90
useSheetStatementFunction · 0.85

Calls 2

extractSheetUIDFunction · 0.90
snapshotOfSheetFunction · 0.85

Tested by

no test coverage detected