Skip to content

Conversation

dharmesh-hemaram
Copy link
Member

…igation API

Copy link
Contributor

@Copilot Copilot AI left a 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

Comment on lines +1 to +3
// ...existing code...

import { RUNTIME_MESSAGE_ACF } from '@dhruv-techapps/acf-common';
Copy link

Copilot AI Sep 14, 2025

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...
Copy link

Copilot AI Sep 14, 2025

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.

Comment on lines +48 to +57
// 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);
}
});
Copy link

Copilot AI Sep 14, 2025

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

Copilot AI Sep 14, 2025

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.

Suggested change
triggerUrlChange: false
triggerUrlChange: false,

Copilot uses AI. Check for mistakes.

@nx-cloud
Copy link

nx-cloud bot commented Sep 14, 2025

View your CI Pipeline Execution ↗ for commit c76829c

Command Status Duration Result
nx affected --target=typecheck --parallel=3 --v... ✅ Succeeded 2s View ↗
nx affected --target=test --parallel=3 --verbos... ✅ Succeeded <1s View ↗
nx affected --target=lint --parallel=3 --verbos... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-14 05:16:49 UTC

@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for b20d7841
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b20d784) Report Missing Report Missing Report Missing
Head commit (b3e6d68) 793 86 10.84%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#698) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@dharmesh-hemaram dharmesh-hemaram merged commit b115233 into main Sep 14, 2025
3 of 5 checks passed
@dharmesh-hemaram dharmesh-hemaram deleted the fix-url-change branch September 14, 2025 05:15
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant