Skip to content

Conversation

spartan-vutrannguyen
Copy link
Contributor

@spartan-vutrannguyen spartan-vutrannguyen commented Jul 22, 2025

Description

  • Added a Pages controller to the left of the top bar — lets you go back, forward, and quickly switch between pages.

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

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.

  • Behavior:
    • Adds PageSelector component in page-selector.tsx for navigating between pages.
    • Integrates PageSelector into TopBar in top-bar.tsx.
    • Updates WebFrameComponent in web-frame.tsx to support navigation.
  • Navigation:
    • Implements FrameNavigationManager in navigation.ts for managing navigation history.
    • Adds navigation methods goBack, goForward, and navigateToPath in manager.ts.
    • Tests navigation functionality in navigation.test.ts.
  • Utilities:
    • Adds inferPageFromUrl in urls.ts to infer page details from URL.
    • Tests inferPageFromUrl in urls.test.ts.

This description was created by Ellipsis for 90cf63e. You can customize this summary. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jul 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 2, 2025 0:03am
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 2, 2025 0:03am

@spartan-vutrannguyen spartan-vutrannguyen marked this pull request as draft July 22, 2025 16:37
Copy link

supabase bot commented Jul 22, 2025

This pull request has been ignored for the connected project wowaemfasoptxrdjhilu because there are no changes detected in apps/backend/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.


editorEngine.frames.updateAndSaveToStorage(frame.id, { position: newPosition });
};
const handleMove = async (e: MouseEvent) => {
Copy link
Contributor

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.

@@ -20,6 +20,11 @@ export class PagesManager {
private currentPath = '';
private groupedRoutes = '';
private _isScanning = false;

// Navigation history
private navigationHistory: string[] = [];
Copy link
Contributor

@Kitenite Kitenite Jul 25, 2025

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.

@@ -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);
Copy link
Contributor

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.

Suggested change
await this.saveToStorage(frameId, frame);
this.saveToStorage(frameId, frame);


let lastUrl = window.location.href;

export function listenToNavigationChanges() {
Copy link
Contributor

@Kitenite Kitenite Jul 31, 2025

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 {
Copy link
Contributor

@Kitenite Kitenite Jul 31, 2025

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', () => {
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor

@Kitenite Kitenite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a regression. You can no longer go back to the home page or page that has children.

Image

Copy link
Contributor

@Kitenite Kitenite left a 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!

@Kitenite Kitenite merged commit 7577e4b into main Aug 1, 2025
3 of 5 checks passed
@Kitenite Kitenite deleted the fix/page-selection branch August 1, 2025 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants