Skip to content

Commit 2375420

Browse files
committed
Fix resource not appearing in sidebar
1 parent 6b346a6 commit 2375420

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

data-browser/src/components/forms/ResourceForm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
useDebounce,
1212
useCanWrite,
1313
isValidURL,
14+
useStore,
1415
} from '@tomic/react';
1516
import styled from 'styled-components';
1617
import { FaCaretDown, FaCaretRight, FaPlus } from 'react-icons/fa';
@@ -74,8 +75,13 @@ export function ResourceForm({
7475
const [tempOtherProps, setTempOtherProps] = useState<string[]>([]);
7576
const [otherProps, setOtherProps] = useState<string[]>([]);
7677
const [showAdvanced, setShowAdvanced] = useState(false);
78+
const store = useStore();
79+
const wasNew: boolean = resource.new;
7780

7881
const [save, saving, err] = useSaveResource(resource, () => {
82+
// We need to read the earlier .new state, because the resource is no
83+
// longer new after it was saved, during this callback
84+
wasNew && store.notifyResourceManuallyCreated(resource);
7985
navigate(constructOpenURL(resource.getSubject()));
8086
});
8187
// I'm not entirely sure if debouncing is needed here.

0 commit comments

Comments
 (0)