Skip to content

Commit

Permalink
fix: prevent LibraryLayout remount
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Jan 16, 2025
1 parent 7aaa8f7 commit 0c33d4c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/library-authoring/LibraryLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ const LibraryLayout = () => {
throw new Error('Error: route is missing libraryId.');
}

const location = useLocation();
const context = useCallback((childPage) => (
<LibraryProvider
/** We need to pass the pathname as key to the LibraryProvider to force a
* re-render when we navigate to a new path or page. */
key={location.pathname}
libraryId={libraryId}
/** The component picker modal to use. We need to pass it as a reference instead of
* directly importing it to avoid the import cycle:
Expand All @@ -44,7 +40,7 @@ const LibraryLayout = () => {
</>
</SidebarProvider>
</LibraryProvider>
), [location.pathname]);
), []);

return (
<Routes>
Expand Down

0 comments on commit 0c33d4c

Please sign in to comment.