File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
data-browser/src/components/forms Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 useDebounce ,
1212 useCanWrite ,
1313 isValidURL ,
14+ useStore ,
1415} from '@tomic/react' ;
1516import styled from 'styled-components' ;
1617import { 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.
You can’t perform that action at this time.
0 commit comments