-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: page selector #2515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: page selector #2515
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
a555538
to
e90f0ff
Compare
|
||
editorEngine.frames.updateAndSaveToStorage(frame.id, { position: newPosition }); | ||
}; | ||
const handleMove = async (e: MouseEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async handler in the mousemove event (handleMove) awaits an update on every movement, which may affect UI responsiveness. Consider debouncing or throttling it.
2c86f6f
to
6352608
Compare
@@ -20,6 +20,11 @@ export class PagesManager { | |||
private currentPath = ''; | |||
private groupedRoutes = ''; | |||
private _isScanning = false; | |||
|
|||
// Navigation history | |||
private navigationHistory: string[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to take into account multiple frames. Not sure if this is even the right place to put this functionality instead of at the frame level. Please test with multiple frames. Might be better there since each frame will handle its own history.
c81a636
to
748fe39
Compare
@@ -198,10 +216,10 @@ export class FramesManager { | |||
const newFrame = { ...existingFrame.frame, ...frame }; | |||
this._frameIdToData.set(frameId, { ...existingFrame, frame: newFrame }); | |||
} | |||
this.saveToStorage(frameId, frame); | |||
await this.saveToStorage(frameId, frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid awaiting a debounced function – the debounced call delays execution and its returned promise may not resolve as expected. Consider refactoring so that saving is handled appropriately without relying on await.
await this.saveToStorage(frameId, frame); | |
this.saveToStorage(frameId, frame); |
|
||
let lastUrl = window.location.href; | ||
|
||
export function listenToNavigationChanges() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overriding a window object is something we REALLY should not be doing... This can create some real issues for users project. What's the reason for the override?
} | ||
|
||
// Navigation history methods | ||
get canGoBack(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be wrong or incomplete when there are multiple frames selected? Why even have these methods? Or show incorrect information for the wrong frames that use this?
Why not let the frame themselves call navigationmanger.canGoBack directly?
}; | ||
|
||
// Listen for popstate events | ||
window.addEventListener('popstate', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not work in my testing. Can you give an example of it working? Why the setTimeout?
function notifyNavigationChange() { | ||
if (penpalParent) { | ||
try { | ||
const currentUrl = window.location.href; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume global state is cleared when page is changed. Can you confirm that this actually works? Why not just look in the history object instead of saving as a variable?
apps/web/client/src/app/project/[id]/_components/canvas/frame/web-frame.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/web/client/src/app/project/[id]/_components/canvas/frame/page-selector.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the regression by making it possible to click on the folder and select it at the same time. It's not perfect and I'm not a fan of how the pages tab determines active pages (way before this PR).
But works well, thanks!
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Screen.Recording.2025-08-01.at.07.30.14.mp4
Additional Notes
Important
Introduces a page selector feature with navigation history management and URL inference for enhanced page navigation.
PageSelector
component inpage-selector.tsx
for navigating between pages.PageSelector
intoTopBar
intop-bar.tsx
.WebFrameComponent
inweb-frame.tsx
to support navigation.FrameNavigationManager
innavigation.ts
for managing navigation history.goBack
,goForward
, andnavigateToPath
inmanager.ts
.navigation.test.ts
.inferPageFromUrl
inurls.ts
to infer page details from URL.inferPageFromUrl
inurls.test.ts
.This description was created by
for 90cf63e. You can customize this summary. It will automatically update as commits are pushed.