fix(editor): Task 2 round 3, lint, locals, stale comment

This commit is contained in:
bchanot committed 2026-11-13 19:51:03 +01:00
1 parent 20905adf72
commit af300de04c
4 files changed
+50 -52

No files matched your search

+9 -5
View File
@@ -449,7 +449,6 @@ function useCitedBy(state: NavigationState, openers: Openers) {
}, [citedBy, openers])
}
/** Navigation of the draft editor: the reducer plus the DOM side (focus, live region). */
/** The reducer and the move machinery every other part of the hook builds on. */
function useNavBase(initialTab: EditorTabId, initialView?: EditorView | null) {
const [state, dispatch] = useReducer(navigationReducer, null, () =>
@@ -459,6 +458,14 @@ function useNavBase(initialTab: EditorTabId, initialView?: EditorView | null) {
return { state, dispatch, trace, mark, ...useGo(dispatch, trace) }
}
/** A Back or Forward landed on a view: restored, no move, no request. */
function useRestoreView(dispatch: Dispatch<NavigationAction>) {
return useCallback(
(view: EditorView) => dispatch({ type: 'restore_view', view }),
[dispatch],
)
}
/** Navigation of the draft editor: the reducer plus the DOM side (focus, live region). */
export function useEditorNavigation(
initialTab: EditorTabId,
@@ -493,9 +500,6 @@ export function useEditorNavigation(
citationsTrigger: useCallback(() => triggerOf(openers), [openers]),
guards,
trace: base.trace,
restoreView: useCallback(
(view: EditorView) => base.dispatch({ type: 'restore_view', view }),
[],
),
restoreView: useRestoreView(base.dispatch),
}
}