fix: Cannot edit templates in settings with separate editing mode

This commit is contained in:
Tom Moor
2023-09-13 20:27:45 -04:00
parent 882408bc0e
commit a32857c715
3 changed files with 10 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ import useStores from "~/hooks/useStores";
import Logger from "~/utils/Logger";
import { NotFoundError, OfflineError } from "~/utils/errors";
import history from "~/utils/history";
import { matchDocumentEdit } from "~/utils/routeHelpers";
import { matchDocumentEdit, settingsPath } from "~/utils/routeHelpers";
import Loading from "./Loading";
type Params = {
@@ -71,7 +71,8 @@ function DataLoader({ match, children }: Props) {
const sharedTree = document
? documents.getSharedTree(document.id)
: undefined;
const isEditRoute = match.path === matchDocumentEdit;
const isEditRoute =
match.path === matchDocumentEdit || match.path.startsWith(settingsPath());
const isEditing = isEditRoute || !auth.user?.separateEditMode;
const can = usePolicy(document?.id);
const location = useLocation<LocationState>();