fixed navbutton fallback
This commit is contained in:
parent
82031ac205
commit
fba1857e1b
2
frontend/next-env.d.ts
vendored
2
frontend/next-env.d.ts
vendored
@ -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.
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user