(core) Open links with different link keys in a new tab

Summary: Check urlState.params.linkParameters in needPageLoad

Test Plan: Added case to nbrowser test, tested manually

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2984
This commit is contained in:
Alex Hall 2021-08-20 17:04:18 +02:00
parent 54b932300b
commit 97cb8065d9

View File

@ -27,6 +27,7 @@ import {UrlState} from 'app/client/lib/UrlState';
import {decodeUrl, encodeUrl, getSlugIfNeeded, GristLoadConfig, IGristUrlState, useNewUI} from 'app/common/gristUrls'; import {decodeUrl, encodeUrl, getSlugIfNeeded, GristLoadConfig, IGristUrlState, useNewUI} from 'app/common/gristUrls';
import {Document} from 'app/common/UserAPI'; import {Document} from 'app/common/UserAPI';
import isEmpty = require('lodash/isEmpty'); import isEmpty = require('lodash/isEmpty');
import isEqual = require('lodash/isEqual');
import {CellValue} from "app/plugin/GristData"; import {CellValue} from "app/plugin/GristData";
/** /**
@ -166,7 +167,10 @@ export class UrlStateImpl {
const newuiReload = useNewUI(prevState.newui) !== useNewUI(newState.newui); const newuiReload = useNewUI(prevState.newui) !== useNewUI(newState.newui);
// Reload when moving to/from a welcome page. // Reload when moving to/from a welcome page.
const welcomeReload = Boolean(prevState.welcome) !== Boolean(newState.welcome); const welcomeReload = Boolean(prevState.welcome) !== Boolean(newState.welcome);
return Boolean(orgReload || billingReload || gristConfig.errPage || docReload || newuiReload || welcomeReload); // Reload when link keys change, which changes what the user can access
const linkKeysReload = !isEqual(prevState.params?.linkParameters, newState.params?.linkParameters);
return Boolean(orgReload || billingReload || gristConfig.errPage
|| docReload || newuiReload || welcomeReload || linkKeysReload);
} }
/** /**