fixed navbutton fallback

This commit is contained in:
Dmitri 2026-03-24 17:39:15 +04:00
parent 82031ac205
commit fba1857e1b
2 changed files with 3 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
/// <reference path="./build/types/routes.d.ts" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

View File

@ -2008,23 +2008,11 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => {
element.navType === 'back' || element.type === 'navigation_prev'
? 'back'
: 'forward';
const configuredTargetId = String(element.targetPageId || '').trim();
const fallbackTargetId = (() => {
const currentPageIndex = pages.findIndex(
(page) => page.id === activePageId,
);
if (currentPageIndex < 0) return '';
const nextPageIndex =
direction === 'back' ? currentPageIndex - 1 : currentPageIndex + 1;
const nextPage = pages[nextPageIndex];
return nextPage ? String(nextPage.id || '').trim() : '';
})();
const targetPageId = configuredTargetId || fallbackTargetId;
const targetPageId = String(element.targetPageId || '').trim();
if (!targetPageId) {
setErrorMessage(
'No target page available for this navigation button.',
'No target page configured for this navigation button.',
);
return;
}