diff --git a/components/common/Editor/index.tsx b/components/common/Editor/index.tsx index 33f2eee5..06bb5dd2 100644 --- a/components/common/Editor/index.tsx +++ b/components/common/Editor/index.tsx @@ -41,13 +41,12 @@ const Editor = ({ onUpdate, ...props }: Props) => { + // Hooks: Router const router = useRouter() const locale = router.locale || 'en' useEffect(() => { - // console.log('Recreating editor...') - // editor?.destroy() - // setEditor(newEditor) + editor?.commands.setContent(formatContent(content)) }, [content]) // Setup: Editor diff --git a/components/party/Party/index.tsx b/components/party/Party/index.tsx index b6206b75..51780610 100644 --- a/components/party/Party/index.tsx +++ b/components/party/Party/index.tsx @@ -46,6 +46,7 @@ const Party = (props: Props) => { // Set up states const { party } = useSnapshot(appState) + const [updatedParty, setUpdatedParty] = useState() const [editable, setEditable] = useState(false) const [refresh, setRefresh] = useState(false) const [errorMessage, setErrorMessage] = useState('') @@ -57,7 +58,10 @@ const Party = (props: Props) => { useEffect(() => { const resetState = clonedeep(initialAppState) appState.grid = resetState.grid - if (props.team) storeParty(props.team) + if (props.team) { + storeParty(props.team) + setUpdatedParty(props.team) + } }, []) // Subscribe to app state to listen for account changes and @@ -108,9 +112,10 @@ const Party = (props: Props) => { let payload = {} if (details) payload = formatDetailsObject(details) - return await api.endpoints.parties - .create(payload) - .then((response) => storeParty(response.data.party)) + return await api.endpoints.parties.create(payload).then((response) => { + storeParty(response.data.party) + setUpdatedParty(response.data.party) + }) } async function updateParty(details: DetailsObject) { @@ -119,7 +124,10 @@ const Party = (props: Props) => { if (props.team && props.team.id) { return await api.endpoints.parties .update(props.team.id, payload) - .then((response) => storeParty(response.data.party)) + .then((response) => { + storeParty(response.data.party) + setUpdatedParty(response.data.party) + }) .catch((error) => { const data = error.response.data if (data.errors && Object.keys(data.errors).includes('guidebooks')) { @@ -438,7 +446,7 @@ const Party = (props: Props) => { {errorAlert()} {
{currentGrid()}