diff --git a/packages/core/src/actions/entries.ts b/packages/core/src/actions/entries.ts index 25ccb7e3..abfbe645 100644 --- a/packages/core/src/actions/entries.ts +++ b/packages/core/src/actions/entries.ts @@ -955,7 +955,11 @@ export function getSerializedEntry(collection: Collection, entry: Entry): Entry return serializedEntry; } -export function persistEntry(collection: Collection, navigate: NavigateFunction) { +export function persistEntry( + collection: Collection, + rootSlug: string | undefined, + navigate: NavigateFunction, +) { return async (dispatch: ThunkDispatch, getState: () => RootState) => { const state = getState(); const entryDraft = state.entryDraft; @@ -1019,6 +1023,7 @@ export function persistEntry(collection: Collection, navigate: NavigateFunction) return backend .persistEntry({ config: configState.config, + rootSlug, collection, entryDraft: newEntryDraft, assetProxies, diff --git a/packages/core/src/backend.ts b/packages/core/src/backend.ts index c1879232..119d4cb0 100644 --- a/packages/core/src/backend.ts +++ b/packages/core/src/backend.ts @@ -822,6 +822,7 @@ export class Backend} /> + } + /> } diff --git a/packages/core/src/components/collections/CollectionHeader.tsx b/packages/core/src/components/collections/CollectionHeader.tsx index ab229061..e2a9160d 100644 --- a/packages/core/src/components/collections/CollectionHeader.tsx +++ b/packages/core/src/components/collections/CollectionHeader.tsx @@ -1,6 +1,6 @@ -import React, { useCallback, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { translate } from 'react-polyglot'; -import { useNavigate, useParams } from 'react-router-dom'; +import { useParams } from 'react-router-dom'; import useEntries from '@staticcms/core/lib/hooks/useEntries'; import useIcon from '@staticcms/core/lib/hooks/useIcon'; @@ -24,17 +24,9 @@ const CollectionHeader = ({ newEntryUrl, t, }: TranslatedProps) => { - const navigate = useNavigate(); - const collectionLabel = collection.label; const collectionLabelSingular = collection.label_singular; - const onNewClick = useCallback(() => { - if (newEntryUrl) { - navigate(newEntryUrl); - } - }, [navigate, newEntryUrl]); - const icon = useIcon(collection.icon); const params = useParams(); @@ -89,7 +81,7 @@ const CollectionHeader = ({ {pluralLabel} {newEntryUrl ? ( -