mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -1336,7 +1336,7 @@ export class GristDoc extends DisposableWithEvents {
|
||||
const options = section.options();
|
||||
const colIds = section.viewFields().all().map((f) => f.column().colId());
|
||||
const chartType = section.chartType();
|
||||
const theme = section.theme();
|
||||
const sectionTheme = section.theme();
|
||||
|
||||
// we must read the current layout from the view layout because it can override the one in
|
||||
// `section.layoutSpec` (in particular it provides a default layout when missing from the
|
||||
@@ -1370,7 +1370,7 @@ export class GristDoc extends DisposableWithEvents {
|
||||
}
|
||||
|
||||
// update theme, and chart type
|
||||
await newSection.theme.saveOnly(theme);
|
||||
await newSection.theme.saveOnly(sectionTheme);
|
||||
await newSection.chartType.saveOnly(chartType);
|
||||
|
||||
// The newly-added section should be given focus.
|
||||
|
||||
@@ -53,6 +53,8 @@ const log: LogWithTimestamp = Object.assign(rawLog, {
|
||||
rawWarn: (msg: string, meta: ILogMeta) => origLog.call(log, 'warn', msg, meta),
|
||||
rawDebug: (msg: string, meta: ILogMeta) => origLog.call(log, 'debug', msg, meta),
|
||||
origLog,
|
||||
add: rawLog.add.bind(rawLog), // Explicitly pass add method along - otherwise
|
||||
// there's an odd glitch under Electron.
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,12 +136,16 @@ export function getDatabaseUrl(options: ConnectionOptions, includeCredentials: b
|
||||
*/
|
||||
export async function checkAllegedGristDoc(docSession: OptDocSession, fname: string) {
|
||||
const db = await SQLiteDB.openDBRaw(fname, OpenMode.OPEN_READONLY);
|
||||
const integrityCheckResults = await db.all('PRAGMA integrity_check');
|
||||
if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') {
|
||||
const uuid = uuidv4();
|
||||
log.info('Integrity check failure on import', {uuid, integrityCheckResults,
|
||||
...getLogMetaFromDocSession(docSession)});
|
||||
throw new Error(`Document failed integrity checks - is it corrupted? Event ID: ${uuid}`);
|
||||
try {
|
||||
const integrityCheckResults = await db.all('PRAGMA integrity_check');
|
||||
if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') {
|
||||
const uuid = uuidv4();
|
||||
log.info('Integrity check failure on import', {uuid, integrityCheckResults,
|
||||
...getLogMetaFromDocSession(docSession)});
|
||||
throw new Error(`Document failed integrity checks - is it corrupted? Event ID: ${uuid}`);
|
||||
}
|
||||
} finally {
|
||||
await db.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user