mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 00:14:10 +08:00
5506eb194b
* Show actual history changes * V2 - WIP * feat: page history diff * fix: exclude content from history listing --------- Co-authored-by: Jason Norwood-Young <jason@10layer.com>
25 lines
735 B
TypeScript
25 lines
735 B
TypeScript
import { useAtom } from "jotai";
|
|
import { useEffect } from "react";
|
|
import {
|
|
activeHistoryIdAtom,
|
|
activeHistoryPrevIdAtom,
|
|
diffCountsAtom,
|
|
} from "@/features/page-history/atoms/history-atoms";
|
|
|
|
/**
|
|
* Resets history state when pageId changes.
|
|
* Clears active selection and diff counts.
|
|
*/
|
|
export function useHistoryReset(pageId: string) {
|
|
const [, setActiveHistoryId] = useAtom(activeHistoryIdAtom);
|
|
const [, setActiveHistoryPrevId] = useAtom(activeHistoryPrevIdAtom);
|
|
const [, setDiffCounts] = useAtom(diffCountsAtom);
|
|
|
|
useEffect(() => {
|
|
setActiveHistoryId("");
|
|
setActiveHistoryPrevId("");
|
|
// @ts-ignore
|
|
setDiffCounts(null);
|
|
}, [pageId, setActiveHistoryId, setActiveHistoryPrevId, setDiffCounts]);
|
|
}
|