I think I have a working document cache solution that's actually pretty good.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Displays a single secret with discovered checkbox and text.
|
||||
import { AutoSaveTextarea } from "@/components/AutoSaveTextarea";
|
||||
import { useDocument } from "@/context/document/DocumentContext";
|
||||
import { useDocumentCache } from "@/context/document/hooks";
|
||||
import { pb } from "@/lib/pocketbase";
|
||||
import type { Secret } from "@/lib/types";
|
||||
import { useState } from "react";
|
||||
@@ -10,7 +10,7 @@ import { useState } from "react";
|
||||
* Handles updating the discovered state and discoveredIn relationship.
|
||||
*/
|
||||
export const SecretEditForm = ({ secret }: { secret: Secret }) => {
|
||||
const { dispatch } = useDocument();
|
||||
const { dispatch } = useDocumentCache();
|
||||
const [checked, setChecked] = useState(
|
||||
!!(secret.data as any)?.secret?.discovered,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user