From 0073b8efd2879097237ecdbbd1bd072fd0451771 Mon Sep 17 00:00:00 2001 From: levipro <47224088+levipro@users.noreply.github.com> Date: Mon, 20 Feb 2023 06:42:10 -0800 Subject: [PATCH] Fix Create object button not available (#125) --- .../src/components/objectManipulation/ObjectAdd.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/flipper-plugin-realm/src/components/objectManipulation/ObjectAdd.tsx b/flipper-plugin-realm/src/components/objectManipulation/ObjectAdd.tsx index b1e4a0d..5dc82bb 100644 --- a/flipper-plugin-realm/src/components/objectManipulation/ObjectAdd.tsx +++ b/flipper-plugin-realm/src/components/objectManipulation/ObjectAdd.tsx @@ -12,19 +12,21 @@ type PropertyType = { schema: SortedObjectSchema; }; +const emptyRealmObject: DeserializedRealmObject = { realmObject: {} }; + export const ObjectAdd = ({ schema }: PropertyType) => { const { addObject } = usePlugin(plugin); - const [values, setValues] = useState(null); + const [values, setValues] = useState(emptyRealmObject); const [visible, setVisible] = useState(false); const showModal = () => { - setValues(null); + setValues(emptyRealmObject); setVisible(true); }; const hideModal = () => { - setValues(null); + setValues(emptyRealmObject); setVisible(false); };