diff --git a/packages/core/src/pages/index.ts b/packages/core/src/pages/index.ts index 910c44ec1..ebb13495e 100644 --- a/packages/core/src/pages/index.ts +++ b/packages/core/src/pages/index.ts @@ -161,33 +161,37 @@ export default class PageManager extends ItemManagerModule= this.pages.length) { - this.em.logError('Index out of bounds'); - } + const currIndex = pages.indexOf(pg); + const sameIndex = currIndex === at; + + if (at < 0 || at >= pages.length || sameIndex) return; - this.remove(page, { temporary: true }); - this.pages.add(page, { at: index }); + this.remove(pg, { ...resOpts, temporary: true }); + pages.add(pg, { ...resOpts, at }); - return page; + return pg; } /**