mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-04-24 20:07:52 +00:00
fix navigation issue
This commit is contained in:
parent
943ce42486
commit
93fb833df5
@ -53,7 +53,7 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => {
|
||||
|
||||
// Signal non-manual navigation
|
||||
iframeRef.current.contentWindow.postMessage(
|
||||
{ action: 'PERFORMING_NON_MANUAL' }, '*'
|
||||
{ action: 'PERFORMING_NON_MANUAL', currentIndex: previousPageIndex }, '*'
|
||||
);
|
||||
console.log('previousPageIndex', previousPageIndex)
|
||||
// Update the current index locally
|
||||
@ -88,10 +88,8 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => {
|
||||
await navigationPromise;
|
||||
console.log('Navigation succeeded within 200ms.');
|
||||
} catch (error) {
|
||||
iframeRef.current.contentWindow.postMessage(
|
||||
{ action: 'PERFORMING_NON_MANUAL' }, '*'
|
||||
);
|
||||
setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${app?.previousPath != null ? previousPath : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}&time=${new Date().getMilliseconds()}&isManualNavigation=false`)
|
||||
|
||||
setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${previousPath != null ? previousPath : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}&time=${new Date().getMilliseconds()}&isManualNavigation=false`)
|
||||
// iframeRef.current.contentWindow.location.href = previousPath; // Fallback URL update
|
||||
}
|
||||
} else {
|
||||
|
@ -426,15 +426,13 @@ isDOMContentLoaded: false
|
||||
setHistory((prev)=> {
|
||||
const copyPrev = {...prev}
|
||||
if((copyPrev?.customQDNHistoryPaths || []).at(-1) === (event?.data?.payload?.customQDNHistoryPaths || []).at(-1)) {
|
||||
console.log('customQDNHistoryPaths.length', prev?.customQDNHistoryPaths.length)
|
||||
return {
|
||||
...prev,
|
||||
currentIndex: prev.customQDNHistoryPaths.length - 1 === -1 ? 0 : prev.customQDNHistoryPaths.length - 1
|
||||
}
|
||||
}
|
||||
const copyHistory = {...prev}
|
||||
const paths = [...(copyHistory?.customQDNHistoryPaths || []), ...(event?.data?.payload?.customQDNHistoryPaths || [])]
|
||||
console.log('paths', paths)
|
||||
const paths = [...(copyHistory?.customQDNHistoryPaths.slice(0, copyHistory.currentIndex + 1) || []), ...(event?.data?.payload?.customQDNHistoryPaths || [])]
|
||||
return {
|
||||
...prev,
|
||||
customQDNHistoryPaths: paths,
|
||||
@ -445,7 +443,7 @@ isDOMContentLoaded: false
|
||||
setHistory(event?.data?.payload)
|
||||
|
||||
}
|
||||
} else if(event?.data?.action === 'SET_TAB'){
|
||||
} else if(event?.data?.action === 'SET_TAB'){
|
||||
executeEvent("addTab", {
|
||||
data: event?.data?.payload
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user