From ec86e80edb137d2cf9e2c378ca47cdefeb5b5161 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 9 Feb 2025 18:41:50 -0500 Subject: [PATCH] PR feedback --- .../Sidebar/components/CollectionLink.tsx | 7 +++++-- .../Sidebar/components/DocumentLink.tsx | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/components/Sidebar/components/CollectionLink.tsx b/app/components/Sidebar/components/CollectionLink.tsx index 101e2ab1f5..4c71b5b9f4 100644 --- a/app/components/Sidebar/components/CollectionLink.tsx +++ b/app/components/Sidebar/components/CollectionLink.tsx @@ -101,9 +101,12 @@ const CollectionLink: React.FC = ({ collection?.addDocument(newDocument); closeAddingNewChild(); - history.replace(documentEditPath(newDocument)); + history.push({ + pathname: documentEditPath(newDocument), + state: { sidebarContext }, + }); }, - [user, closeAddingNewChild, history, collection, documents] + [user, sidebarContext, closeAddingNewChild, history, collection, documents] ); return ( diff --git a/app/components/Sidebar/components/DocumentLink.tsx b/app/components/Sidebar/components/DocumentLink.tsx index 818a9c2467..97ffa795e3 100644 --- a/app/components/Sidebar/components/DocumentLink.tsx +++ b/app/components/Sidebar/components/DocumentLink.tsx @@ -240,9 +240,21 @@ function InnerDocumentLink( collection?.addDocument(newDocument, node.id); closeAddingNewChild(); - history.replace(documentEditPath(newDocument)); + history.push({ + pathname: documentEditPath(newDocument), + state: { sidebarContext }, + }); }, - [documents, collection, user, node, doc, history, closeAddingNewChild] + [ + documents, + collection, + sidebarContext, + user, + node, + doc, + history, + closeAddingNewChild, + ] ); return (