web: force list pane to be visible when reveal item in list is called

This commit is contained in:
Abdullah Atta
2025-03-27 13:48:59 +05:00
parent 694b564172
commit 846e28553d

View File

@@ -132,7 +132,6 @@ function DesktopAppContents() {
const isFocusMode = useStore((store) => store.isFocusMode);
const isListPaneVisible = useStore((store) => store.isListPaneVisible);
const isTablet = useTablet();
// const [isNarrow, setIsNarrow] = useState(isTablet || false);
const navPane = useRef<SplitPaneImperativeHandle>(null);
useEffect(() => {
@@ -140,6 +139,23 @@ function DesktopAppContents() {
else if (navPane.current?.isCollapsed(0)) navPane.current?.expand(0);
}, [isTablet]);
useEffect(() => {
const event = AppEventManager.subscribe(
AppEvents.revealItemInList,
async (id?: string) => {
if (!useStore.getState().isListPaneVisible) {
useStore.getState().toggleListPane(true);
setTimeout(() => {
AppEventManager.publish(AppEvents.revealItemInList, id);
}, 500);
}
}
);
return () => {
event.unsubscribe();
};
}, []);
return (
<>
<Flex