From 638a4f3b448cf5ad42af7f570f695398d6c22bf7 Mon Sep 17 00:00:00 2001 From: Marcelo Serpa <81248+fullofcaffeine@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:21:06 -0600 Subject: [PATCH] (edit-site)(use-init-edited-entity-from-url) Safely access `toString()` on `siteData`'s `page_on_front` (#57035) --- .../sync-state-with-url/use-init-edited-entity-from-url.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js index 46079cbce8efd..7b1321fdf4b8a 100644 --- a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +++ b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js @@ -54,7 +54,10 @@ function useResolveEditedEntityAndContext( { postId, postType } ) { return { hasLoadedAllDependencies: !! base && !! siteData, homepageId: - siteData?.show_on_front === 'page' + siteData?.show_on_front === 'page' && + [ 'number', 'string' ].includes( + typeof siteData.page_on_front + ) ? siteData.page_on_front.toString() : null, url: base?.home,