Skip to content

Make "Open in new window" respect project-type#2260

Open
myieye wants to merge 5 commits intodevelopfrom
claude/fix-open-window-project-type-aGJh1
Open

Make "Open in new window" respect project-type#2260
myieye wants to merge 5 commits intodevelopfrom
claude/fix-open-window-project-type-aGJh1

Conversation

@myieye
Copy link
Copy Markdown
Collaborator

@myieye myieye commented May 8, 2026

Resolves #2261

claude added 4 commits May 8, 2026 07:33
Previously the URL was hardcoded to /project/<code>/browse, which is
wrong for fwdata projects (/fwdata/<name>/browse) and for paratext-
embedded projects (/paratext/...). Read projectType, projectCode, and
inParatext from the ProjectContext at invocation time so the context
is fully initialized when used.
@github-actions github-actions Bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

UI unit Tests

  1 files   59 suites   30s ⏱️
176 tests 176 ✅ 0 💤 0 ❌
245 runs  245 ✅ 0 💤 0 ❌

Results for commit 70f096a.

♻️ This comment has been updated with latest results.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 91424b6b-5e93-4572-a01d-07e83a55c4a7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

MultiWindowService is refactored to depend on ProjectContext injected via useProjectContext(). The constructor now accepts ProjectContext as a required parameter. URL construction for new windows now uses projectType and projectCode from the injected context instead of parsing location.pathname. The useMultiWindowService() hook is updated to provide the context on instantiation for both the .NET service and fallback paths.

Changes

ProjectContext Injection into MultiWindowService

Layer / File(s) Summary
Constructor and Imports
frontend/viewer/src/lib/services/multi-window-service.ts
MultiWindowService constructor signature updated to accept ProjectContext as first parameter; ProjectContext and useProjectContext are imported for dependency injection.
URL Building Logic
frontend/viewer/src/lib/services/multi-window-service.ts
openEntryInNewWindow switches from parsing location.pathname to extracting projectType and projectCode from _projectContext for URL construction.
Hook Integration
frontend/viewer/src/lib/services/multi-window-service.ts
useMultiWindowService now calls useProjectContext and passes the resolved context to MultiWindowService constructor in both the .NET service available and fallback instantiation paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

💻 FW Lite

Poem

🐰 A context flows through the service so bright,
No more parsing paths in the bounding light,
ProjectContext now leads the way,
MultiWindow opens entries each day! 🪟✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description references issue #2261, which relates to the changeset. The objectives confirm the PR updates MultiWindowService to use ProjectContext for dynamic project routing, aligning with the code changes shown in the summary.
Title check ✅ Passed The title accurately summarizes the main change: MultiWindowService now respects project-type when opening entries in new windows by using ProjectContext instead of parsing the URL.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-open-window-project-type-aGJh1

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 8, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - May 8, 2026, 2:53 PM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

C# Unit Tests

165 tests   165 ✅  19s ⏱️
 23 suites    0 💤
  1 files      0 ❌

Results for commit 70f096a.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/viewer/src/lib/services/multi-window-service.ts (1)

43-44: ⚡ Quick win

new URL(location.href) is only used to read .hash – prefer location.hash directly.

location.hash returns the exact same value (including the # prefix or empty string) with no object allocation.

♻️ Proposed simplification
-    const url = new URL(location.href);
-    await this.openNewWindow(`${browsePath}?${entryBrowseParams(entryId)}${url.hash}`, SM_VIEW_MAX_WIDTH);
+    await this.openNewWindow(`${browsePath}?${entryBrowseParams(entryId)}${location.hash}`, SM_VIEW_MAX_WIDTH);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/viewer/src/lib/services/multi-window-service.ts` around lines 43 -
44, The code unnecessarily constructs new URL(location.href) just to read .hash;
replace that allocation by using location.hash directly in the call to
openNewWindow so the URL becomes
`${browsePath}?${entryBrowseParams(entryId)}${location.hash}` (update the call
site where openNewWindow is invoked, referencing openNewWindow,
entryBrowseParams and SM_VIEW_MAX_WIDTH).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@frontend/viewer/src/lib/services/multi-window-service.ts`:
- Around line 43-44: The code unnecessarily constructs new URL(location.href)
just to read .hash; replace that allocation by using location.hash directly in
the call to openNewWindow so the URL becomes
`${browsePath}?${entryBrowseParams(entryId)}${location.hash}` (update the call
site where openNewWindow is invoked, referencing openNewWindow,
entryBrowseParams and SM_VIEW_MAX_WIDTH).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 99ceaef5-5cbf-4fb5-ba5f-27f78ae1e225

📥 Commits

Reviewing files that changed from the base of the PR and between 1232eea and f51d72d.

📒 Files selected for processing (1)
  • frontend/viewer/src/lib/services/multi-window-service.ts

@myieye myieye changed the title Use ProjectContext in MultiWindowService for dynamic project routing Make "Open in new window" respect project-type May 8, 2026
@myieye myieye force-pushed the claude/fix-open-window-project-type-aGJh1 branch from 3d53a22 to 70f096a Compare May 8, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open in new window assumes CRDT project type

2 participants