A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: fix list pane not expanding (#7963)
01zulfi21fdc39db75b
diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsxindex 6906033c2..49ca2f653 100644--- a/apps/web/src/app.tsx+++ b/apps/web/src/app.tsx@@ -164,8 +164,11 @@ function DesktopAppContents() {useEffect(() => {if (isListPaneVisible) {- navPane.current?.expand(1);- navPane.current?.reset(1);+ if (navPane.current?.hasExpandedSize(1)) {+ navPane.current?.expand(1);+ } else {+ navPane.current?.reset(1);+ }} else {navPane.current?.collapse(1);}diff --git a/apps/web/src/components/split-pane/index.tsx b/apps/web/src/components/split-pane/index.tsxindex 469ee73c2..5c43714ba 100644--- a/apps/web/src/components/split-pane/index.tsx+++ b/apps/web/src/components/split-pane/index.tsx@@ -62,6 +62,7 @@ export type SplitPaneImperativeHandle = {expand: (index: number) => void;reset: (index: number) => void;isCollapsed: (index: number) => boolean;+ hasExpandedSize: (index: number) => boolean;};export const SplitPane = React.forwardRef<SplitPaneImperativeHandle,@@ -281,8 +282,9 @@ export const SplitPane = React.forwardRef<const currentPane = paneSizes.current[index];if (!currentPane || !currentPane.collapsed) return;currentPane.collapsed = false;- currentPane.size =- currentPane.expandedSize ?? currentPane.initialSize;+ currentPane.size = !!currentPane.expandedSize+ ? currentPane.expandedSize+ : currentPane.initialSize;currentPane.expandedSize = undefined;setSizes(paneSizes.current, wrapSize.current);},@@ -296,6 +298,9 @@ export const SplitPane = React.forwardRef<},isCollapsed: (index: number) => {return paneSizes.current[index].collapsed;+ },+ hasExpandedSize: (index: number) => {+ return paneSizes.current[index].expandedSize !== undefined;}};},@@ -375,6 +380,19 @@ export const SplitPane = React.forwardRef<nextPane.nextSize = undefined;currentPane.nextSize = undefined;+ [currentPane, nextPane].forEach((pane) => {+ if (pane.size === 0) {+ // if pane size is 0, collapsed should be true+ pane.collapsed = true;+ }+ if (pane.min === 0 && pane.size < pane.snap) {+ // if pane min is 0, and size is less than snap, collapsed should be true+ pane.collapsed = true;+ // and size should be set to 0+ pane.size = 0;+ }+ });+setSizes(paneSizes.current, wrapSize.current);},[paneSizes, setSizes, splitAxis]