-
-
Notifications
You must be signed in to change notification settings - Fork 6
Simplify DOM watcher with configuration-level settings and automatic action restart #668
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
Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
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 a comprehensive DOM Watcher system that enables actions to automatically re-execute when new matching elements are dynamically added to the page. This addresses scenarios like infinite scrolling feeds, live comments, and async content updates where actions would previously only run once and miss subsequently loaded content.
Key Changes:
- DOM Watcher configuration system with customizable settings (debounce timing, max repeats, visibility checks, timeouts)
- MutationObserver-based monitoring with performance optimizations and element deduplication
- DevTools panel for real-time monitoring and control of DOM watching activities
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
packages/acf/common/src/lib/model/IAction.ts |
Adds DOM watcher configuration interfaces and default settings |
apps/acf-options-page/src/modal/action-settings.modal.tsx |
Implements DOM watcher settings UI with comprehensive configuration options |
apps/acf-extension/src/content_scripts/util/dom-watch-manager.ts |
Core DOM watching implementation with MutationObserver and element processing logic |
apps/acf-extension/src/devtools/dom-watcher-*.{ts,js,html} |
DevTools panel for monitoring and controlling DOM watcher behavior |
apps/acf-extension/src/background/dom-watcher-devtools.ts |
Background script communication handler for DevTools integration |
site/src/content/docs/action/action-settings.mdx |
Comprehensive documentation with configuration guide and real-world examples |
apps/acf-extension/src/content_scripts/util/dom-watch-manager.ts
Outdated
Show resolved
Hide resolved
apps/acf-extension/src/content_scripts/util/dom-watch-manager.ts
Outdated
Show resolved
Hide resolved
apps/acf-options-page/src/store/config/action/settings/action-settings.slice.ts
Outdated
Show resolved
Hide resolved
apps/acf-options-page/src/store/config/action/settings/action-settings.slice.ts
Outdated
Show resolved
Hide resolved
@copilot Certain times there are more than once action for single operation. Like you want to select a value from dropdown which is custom build . So you click it to open . Search and filter and then click required option for this scenario moving single action and running it independently will not work it should be like execution should start from that action again. |
Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
I've added sequential action restart modes that solve this exact problem. You can now configure the DOM watcher to restart action sequences instead of just re-executing individual actions. For your custom dropdown scenario:
When new options load, Action 3 triggers and restarts the sequence from Action 3, ensuring the search filter is applied before clicking the new option. This maintains the proper workflow state. Three restart modes are available:
This is now configurable in Action Settings → DOM Watcher Settings → Restart Mode. Commit: dfeaf47 |
…settings.slice.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
…settings.slice.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
I've implemented the configuration-level DOM watcher approach as requested. The system now works much more simply: Key Changes:
How it works:
This approach is much cleaner and easier to understand compared to the previous per-action complexity. The watcher is registered after initial actions complete and triggers sequence restarts when relevant DOM changes occur. Commit: f2f86f0 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ate into configuration-level settings
View your CI Pipeline Execution ↗ for commit 294ce4f
☁️ Nx Cloud last updated this comment at |
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 simplifies the DOM watcher system by consolidating complex per-action configurations into a single configuration-level approach that automatically restarts all actions when DOM changes occur. This transformation eliminates the need for individual action watch settings and complex restart modes, making DOM watching more intuitive for use cases like custom dropdowns and infinite scrolling.
Key Changes
- Introduced configuration-level
IWatchSettings
interface with automatic action sequence restart capability - Added comprehensive DOM watcher management with debouncing and lifecycle controls
- Created complete UI components for watch configuration in the options page
Reviewed Changes
Copilot reviewed 43 out of 46 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
packages/acf/common/src/lib/model/IWatch.ts |
Defines new watch settings interface with defaults |
packages/acf/common/src/lib/model/IConfiguration.ts |
Adds optional watch property to configuration model |
apps/acf-extension/src/content_scripts/util/dom-watch-manager.ts |
Core DOM watcher implementation with mutation observer |
apps/acf-extension/src/content_scripts/config.ts |
Integrates DOM watcher initialization into configuration processing |
apps/acf-options-page/src/store/config/watch/ |
Redux store management for watch settings |
apps/acf-options-page/src/modal/config-watch/ |
UI components for watch configuration |
site/src/content/docs/configuration/watch.mdx |
Comprehensive documentation for the new watch feature |
apps/acf-extension/src/content_scripts/util/dom-watch-manager.ts
Outdated
Show resolved
Hide resolved
apps/acf-options-page/src/modal/config-watch/watch-settings.tsx
Outdated
Show resolved
Hide resolved
… Firebase dependencies
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dharmesh <dharmesh.hemaram@gmail.com>
… for dependency version upgrades
|
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
|
This PR fundamentally simplifies the DOM watcher system by moving from complex per-action configurations to a single configuration-level approach that automatically restarts all actions when DOM changes occur.
Problem Solved
The original implementation had significant complexity with per-action watch settings and multiple restart modes, making it difficult to configure and understand. For workflows like custom dropdown interactions, users had to configure each action individually with complex restart logic.
Solution: Configuration-Level DOM Watching
🎯 Simplified Architecture
IConfiguration.watch
)data-acf-processed
to prevent infinite loops⚙️ Streamlined Interface
The watch configuration uses a clean, minimal interface:
🔄 How It Works
Real-World Benefits
Custom Dropdown Workflows:
Multi-Step Form Automation:
Technical Implementation
Execution Flow
Backward Compatibility
This transformation makes DOM watching intuitive and powerful while eliminating the complexity that made it difficult to use effectively.
Fixes #667.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.