I think I have a working document cache solution that's actually pretty good.
This commit is contained in:
@@ -3,7 +3,7 @@ import type { CampaignId, Monster } from "@/lib/types";
|
||||
import { pb } from "@/lib/pocketbase";
|
||||
import { BaseForm } from "@/components/form/BaseForm";
|
||||
import { SingleLineInput } from "@/components/form/SingleLineInput";
|
||||
import { useDocument } from "@/context/document/DocumentContext";
|
||||
import { useDocumentCache } from "@/context/document/hooks";
|
||||
|
||||
/**
|
||||
* Renders a form to add a new monster. Calls onCreate with the new monster document.
|
||||
@@ -15,7 +15,7 @@ export const NewMonsterForm = ({
|
||||
campaign: CampaignId;
|
||||
onCreate: (monster: Monster) => Promise<void>;
|
||||
}) => {
|
||||
const { dispatch } = useDocument();
|
||||
const { dispatch } = useDocumentCache();
|
||||
const [name, setName] = useState("");
|
||||
const [adding, setAdding] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user