mirror of
https://github.com/docmost/docmost.git
synced 2026-08-20 00:11:37 +10:00
refactor(client): type comparePairAtom initializer so setters infer as writable
This commit is contained in:
@@ -11,4 +11,6 @@ export const diffCountsAtom = atom<DiffCounts | null>(null);
|
||||
export type ComparePair = { newerId: string; olderId: string };
|
||||
export const compareModeAtom = atom<boolean>(false);
|
||||
export const compareSelectionAtom = atom<string[]>([]);
|
||||
export const comparePairAtom = atom<ComparePair | null>(null);
|
||||
export const comparePairAtom = atom<ComparePair | null>(
|
||||
null as ComparePair | null,
|
||||
);
|
||||
|
||||
@@ -38,7 +38,6 @@ function HistoryList({ pageId }: Props) {
|
||||
const setHistoryModalOpen = useSetAtom(historyAtoms);
|
||||
const [compareMode, setCompareMode] = useAtom(compareModeAtom);
|
||||
const [compareSelection, setCompareSelection] = useAtom(compareSelectionAtom);
|
||||
// @ts-ignore
|
||||
const setComparePair = useSetAtom(comparePairAtom);
|
||||
|
||||
const {
|
||||
@@ -87,7 +86,6 @@ function HistoryList({ pageId }: Props) {
|
||||
|
||||
const handleSelect = useCallback(
|
||||
(id: string, index: number) => {
|
||||
// @ts-ignore
|
||||
setComparePair(null);
|
||||
setActiveHistoryId(id);
|
||||
setActiveHistoryPrevId(historyItems[index + 1]?.id ?? "");
|
||||
@@ -108,7 +106,6 @@ function HistoryList({ pageId }: Props) {
|
||||
|
||||
const handleStartCompare = useCallback(
|
||||
(id: string) => {
|
||||
// @ts-ignore
|
||||
setComparePair(null);
|
||||
setCompareMode(true);
|
||||
setCompareSelection([id]);
|
||||
|
||||
@@ -26,7 +26,6 @@ export function useHistoryReset(pageId: string) {
|
||||
const resetCompare = () => {
|
||||
setCompareMode(false);
|
||||
setCompareSelection([]);
|
||||
// @ts-ignore
|
||||
setComparePair(null);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user