Skip to content

Conversation

os1rix
Copy link
Contributor

@os1rix os1rix commented May 19, 2025

I'll open this PR as a draft since there is still a bug. Will get back to it when I get the idea on how to fix it. Here is a quick description.

A toggle button was added in RecordingView.tsx next to the "Stop Recording" button, allowing users to enable/disable highlighting. The feature leverages the WorkflowContext in workflow-provider.tsx to manage state and communicate with the background script (background.ts) via messages like START_HIGHLIGHTING and STOP_HIGHLIGHTING. While the highlighting works as expected when manually triggered, the toggle button consistently throws a Chrome runtime error: "The message port was closed before a response was received". I suspect the issue lies in the useEffect hook or state management within workflow-provider.tsx, possibly due to the lifecycle of the message listener.

Changes Made:
In workflow-provider.tsx, I added highlightingStatus to the context, implemented startHighlighting and stopHighlighting methods, and updated the useEffect hook to listen for highlighting_status_updated messages. In background.ts, I added broadcastHighlightingStatus to notify the side panel. content.ts was updated to handle SET_HIGHLIGHTING_STATUS, and RecordingView.tsx now includes a ToggleButton component (added in button.tsx) for the toggle UI. To debug, check the side panel console (right-click → Inspect) for missing logs (e.g., “Start highlighting acknowledged by background”) and the background console (chrome://extensions/ → “inspect views”) for “Received START_HIGHLIGHTING request.”

@os1rix os1rix changed the title Highlighting feature on/off for highlighting feature May 19, 2025
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.

1 participant