-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(url-change): implement URL change tracking for SPAs using webNav… #698
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
Conversation
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.
Pull Request Overview
This PR implements URL change tracking for Single Page Applications (SPAs) using the webNavigation API. The changes enhance the extension's ability to detect URL changes in SPAs that don't trigger traditional page loads, allowing automatic actions to be triggered when users navigate within the same domain.
- Adds a configuration option to enable URL change triggering for SPAs
- Implements a robust URL change detection system with debouncing and proper cleanup
- Moves URL change logic from the main background script to a dedicated module
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
packages/acf/common/src/lib/model/IConfiguration.ts | Adds triggerUrlChange boolean flag to configuration interface with default value |
apps/acf-extension/src/background/watch-url-change.ts | New module implementing comprehensive URL change tracking with debouncing and cleanup |
apps/acf-extension/src/background/index.ts | Removes inline URL change logic in favor of the dedicated module |
// ...existing code... | ||
|
||
import { RUNTIME_MESSAGE_ACF } from '@dhruv-techapps/acf-common'; |
Copilot
AI
Sep 14, 2025
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 placeholder comments // ...existing code...
should be removed as they don't add value and create confusion about the actual file structure.
Copilot uses AI. Check for mistakes.
debounceTimers.delete(removedTabId); | ||
}); | ||
|
||
// ...existing code... |
Copilot
AI
Sep 14, 2025
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 placeholder comments // ...existing code...
should be removed as they don't add value and create confusion about the actual file structure.
Copilot uses AI. Check for mistakes.
// Optionally also react to hash-only changes (SPA routers sometimes use fragments) | ||
chrome.webNavigation.onReferenceFragmentUpdated.addListener((details) => { | ||
if (details.frameId !== 0 || !isTrackableUrl(details.url)) return; | ||
|
||
const last = lastUrlByTab.get(details.tabId); | ||
if (last !== details.url) { | ||
lastUrlByTab.set(details.tabId, details.url); | ||
scheduleUrlChange(details.tabId); | ||
} | ||
}); |
Copilot
AI
Sep 14, 2025
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 hash change listener duplicates logic from the history state listener. Consider extracting the URL change detection logic into a shared function to avoid code duplication.
Copilot uses AI. Check for mistakes.
actions: actions || [getDefaultAction()], | ||
updated: true | ||
updated: true, | ||
triggerUrlChange: false |
Copilot
AI
Sep 14, 2025
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 trailing comma is missing after triggerUrlChange: false
, which is inconsistent with the existing code style that includes trailing commas.
triggerUrlChange: false | |
triggerUrlChange: false, |
Copilot uses AI. Check for mistakes.
View your CI Pipeline Execution ↗ for commit c76829c
☁️ Nx Cloud last updated this comment at |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
…igation API