mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Update active view id when default view id changes
Summary: This fixes a bug where deleting a page with the page id missing from the URL would cause JS errors to be thrown. Test Plan: Verified manually in dev environment. Browser test added that should hopefully replicate the repro steps and catch any regressions. Reviewers: dsagal, paulfitz Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2856
This commit is contained in:
parent
6f02987d10
commit
982711dbba
@ -153,7 +153,9 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
const defaultViewId = this.docInfo.newDefaultViewId;
|
const defaultViewId = this.docInfo.newDefaultViewId;
|
||||||
|
|
||||||
// Grainjs observable for current view id, which may be a string such as 'code'.
|
// Grainjs observable for current view id, which may be a string such as 'code'.
|
||||||
this.activeViewId = Computed.create(this, urlState().state, (use, s) => s.docPage || defaultViewId.peek());
|
this.activeViewId = Computed.create(this, (use) => {
|
||||||
|
return use(urlState().state).docPage || use(defaultViewId);
|
||||||
|
});
|
||||||
|
|
||||||
// This viewModel reflects the currently active view, relying on the fact that
|
// This viewModel reflects the currently active view, relying on the fact that
|
||||||
// createFloatingRowModel() supports an observable rowId for its argument.
|
// createFloatingRowModel() supports an observable rowId for its argument.
|
||||||
|
Loading…
Reference in New Issue
Block a user