From 7516aae885f3ba7512c1da44212ea9afb8036550 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Sun, 10 Nov 2024 22:45:45 +0530 Subject: [PATCH] fix: Fix issue with toggling notes panel back on when it has been turned off (fixes standardnotes/forum#3754) --- .../Components/ContentListView/ContentListView.tsx | 7 +++---- .../web/src/javascripts/Components/Panes/usePaneGesture.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx b/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx index 7fe604fd4f7..3d9328a108e 100644 --- a/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx @@ -11,7 +11,7 @@ import { WebApplication } from '@/Application/WebApplication' import { PANEL_NAME_NOTES } from '@/Constants/Constants' import { FileItem, Platform, PrefKey, WebAppEvent } from '@standardnotes/snjs' import { observer } from 'mobx-react-lite' -import { forwardRef, useCallback, useEffect, useMemo } from 'react' +import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react' import ContentList from '@/Components/ContentListView/ContentList' import NoAccountWarning from '@/Components/NoAccountWarning/NoAccountWarning' import { ElementIds } from '@/Constants/ElementIDs' @@ -25,7 +25,6 @@ import DailyContentList from './Daily/DailyContentList' import { ListableContentItem } from './Types/ListableContentItem' import { FeatureName } from '@/Controllers/FeatureName' import { PanelResizedData } from '@/Types/PanelResizedData' -import { useForwardedRef } from '@/Hooks/useForwardedRef' import FloatingAddButton from './FloatingAddButton' import ContentTableView from '../ContentTableView/ContentTableView' import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery' @@ -77,7 +76,7 @@ const ContentListView = forwardRef( selectPreviousItem, } = itemListController - const innerRef = useForwardedRef(ref) + const innerRef = useRef(null) const { addDragTarget, removeDragTarget } = useFileDragNDrop() @@ -297,7 +296,7 @@ const ContentListView = forwardRef( id={id} className={classNames(className, 'sn-component section h-full overflow-hidden pt-safe-top')} aria-label={'Notes & Files'} - ref={mergeRefs([innerRef, setElement])} + ref={mergeRefs([ref, innerRef, setElement])} > {isMobileScreen && !itemListController.isMultipleSelectionMode && ( diff --git a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts index 24a998d83c2..110d1e73b6e 100644 --- a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts +++ b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts @@ -269,5 +269,5 @@ export const usePaneSwipeGesture = ( } }, [direction, element, isMobileScreen, onSwipeEndRef, isEnabled, adjustedGesture, requiresStartFromEdge]) - return [setElement] + return [setElement] as const }