mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) open documents without blocking on data engine
Summary: With this diff, when a user opens a Grist document in a browser, they will be able to view its contents without waiting for the data engine to start up. Once the data engine starts, it will run a calculation and send any updates made. Changes to the document will be blocked until the engine is started and the initial calculation is complete. The increase in responsiveness is useful in its own right, and also reduces the impact of an extra startup time in a candidate next-generation sandbox. A small unrelated fix is included for `core/package.json`, to catch up with a recent change to `package.json`. A small `./build schema` convenience is added to just rebuild the typescript schema file. Test Plan: added test; existing tests pass - small fixes needed in some cases because of new timing Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3036
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {DocComm} from "app/client/components/DocComm";
|
||||
import {IOnBoardingMsg, startOnBoarding} from "app/client/ui/OnBoardingPopups";
|
||||
import {DocData} from "../../common/DocData";
|
||||
import * as _ from "lodash";
|
||||
@@ -9,8 +10,8 @@ import {IconList, IconName} from "../ui2018/IconList";
|
||||
import {cssButtons, cssLinkBtn, cssLinkIcon} from "./ExampleCard";
|
||||
|
||||
|
||||
export async function startDocTour(docData: DocData, onFinishCB: () => void) {
|
||||
const docTour: IOnBoardingMsg[] = await makeDocTour(docData) || invalidDocTour;
|
||||
export async function startDocTour(docData: DocData, docComm: DocComm, onFinishCB: () => void) {
|
||||
const docTour: IOnBoardingMsg[] = await makeDocTour(docData, docComm) || invalidDocTour;
|
||||
exposeDocTour(docTour);
|
||||
startOnBoarding(docTour, onFinishCB);
|
||||
}
|
||||
@@ -23,11 +24,15 @@ const invalidDocTour: IOnBoardingMsg[] = [{
|
||||
showHasModal: true,
|
||||
}];
|
||||
|
||||
async function makeDocTour(docData: DocData): Promise<IOnBoardingMsg[] | null> {
|
||||
async function makeDocTour(docData: DocData, docComm: DocComm): Promise<IOnBoardingMsg[] | null> {
|
||||
const tableId = "GristDocTour";
|
||||
if (!docData.getTable(tableId)) {
|
||||
return null;
|
||||
}
|
||||
// Make sure any formulas in GristDocTour table have had time to evaluate. For example, for a
|
||||
// first time open of a new document copy, any use of SELF_HYPERLINK will be stale since the URL
|
||||
// of the document has changed.
|
||||
await docComm.waitForInitialization();
|
||||
await docData.fetchTable(tableId);
|
||||
const tableData = docData.getTable(tableId)!;
|
||||
const result = _.sortBy(tableData.getRowIds(), tableData.getRowPropFunc('manualSort') as any).map(rowId => {
|
||||
|
||||
@@ -95,7 +95,7 @@ export function tools(owner: Disposable, gristDoc: GristDoc, leftPanelOpen: Obse
|
||||
automaticHelpTool(
|
||||
async ({markAsSeen}) => {
|
||||
const gristDocModule = await loadGristDoc();
|
||||
await gristDocModule.startDocTour(gristDoc.docData, markAsSeen);
|
||||
await gristDocModule.startDocTour(gristDoc.docData, gristDoc.docComm, markAsSeen);
|
||||
},
|
||||
gristDoc,
|
||||
"seenDocTours",
|
||||
|
||||
Reference in New Issue
Block a user