Skip to content

Conversation

@edgarsj
Copy link
Owner

@edgarsj edgarsj commented Jan 18, 2026

Summary

  • set launch handler to open new window per file
  • remove modal-closing workaround from file handling

Testing

  • not run

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 18, 2026

Deploying edocviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 054f760
Status: ✅  Deploy successful!
Preview URL: https://5deb2a4d.edocviewer.pages.dev
Branch Preview URL: https://pwa-multi-window.edocviewer.pages.dev

View logs

@greptile-apps
Copy link

greptile-apps bot commented Jan 18, 2026

Greptile Summary

This PR simplifies file handling by changing the PWA launch behavior from reusing existing windows to always opening new windows. By updating the launch_handler.client_mode to navigate-new in the manifest, each file now opens in a fresh app instance, eliminating the need for the closeOpenModals() workaround that was previously required to handle modal state from previous file interactions. The changes are cohesive and correct—the removal of the workaround method directly corresponds to the new launch behavior.

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues.
  • The changes are minimal, focused, and correct. The manifest change to navigate-new ensures each file opens in a fresh window, eliminating the need for the modal-closing workaround. The code removal is clean with no dangling references. The changes are logically coherent and improve the codebase by removing unnecessary workaround code.
  • No files require special attention

Important Files Changed

Filename Overview
src/components/EdocApp.ts Removed closeOpenModals() method and its call in onFileSelected(). This cleanup is safe because the new launch_handler mode opens files in new windows, eliminating the need for modal closure workarounds.
src/webapp/manifest.json Updated launch_handler.client_mode from ["focus-existing", "auto"] to ["navigate-new"]. This ensures each file open creates a new window instance, providing a clean state for new files.

Sequence Diagram

sequenceDiagram
    participant User
    participant OS
    participant PrevApp as Previous App<br/>(focus-existing)
    participant NewApp as New App<br/>(navigate-new)
    
    alt Previous: focus-existing behavior
        User->>OS: Open file #1
        OS->>PrevApp: Send to existing window
        PrevApp->>PrevApp: closeOpenModals()<br/>(workaround)
        PrevApp->>PrevApp: Load file #1
        
        User->>OS: Open file #2
        OS->>PrevApp: Send to existing window
        PrevApp->>PrevApp: closeOpenModals()<br/>(workaround)
        PrevApp->>PrevApp: Load file #2
    end
    
    alt Current: navigate-new behavior
        User->>OS: Open file #1
        OS->>NewApp: Create new window
        NewApp->>NewApp: Load file #1<br/>(clean state)
        
        User->>OS: Open file #2
        OS->>NewApp: Create new window
        NewApp->>NewApp: Load file #2<br/>(clean state)
    end
Loading

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