Skip to content

fix: capture text highlighting on discard #556

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

RohitR311
Copy link
Collaborator

@RohitR311 RohitR311 commented Apr 25, 2025

What this PR does?

Fixes the issue where the highlighter displays selection for Capture List instead of Capture Text on discarding Capture List action

Fixes: #555

Summary by CodeRabbit

  • Bug Fixes
    • Improved synchronization between local and socket states when stopping pagination and "get list" actions for consistent behavior.
    • Enhanced cleanup when discarding a list capture by explicitly stopping pagination and limit modes, ensuring better UI state management.

@RohitR311 RohitR311 added the Type: Bug Something isn't working label Apr 25, 2025
Copy link

coderabbitai bot commented Apr 25, 2025

## Walkthrough

The `stopPaginationMode` and `stopGetList` functions in `src/context/browserActions.tsx` were updated to emit respective socket events (`'setPaginationMode'` and `'setGetList'`) with false flags after updating local state, ensuring socket state synchronization. In `src/components/recorder/RightSidePanel.tsx`, the `discardGetList` callback was enhanced to explicitly call `stopPaginationMode()` and `stopLimitMode()` to properly terminate pagination and limit modes when discarding a list capture. No other logic or exported entity declarations were changed.

## Changes

| Files                                               | Change Summary                                                                                                       |
|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| src/context/browserActions.tsx                      | Added socket emission of `'setPaginationMode'` and `'setGetList'` events with false flags after updating local state |
| src/components/recorder/RightSidePanel.tsx         | Added calls to `stopPaginationMode()` and `stopLimitMode()` within `discardGetList` callback to explicitly stop modes |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant RightSidePanel
    participant BrowserActions
    participant Socket

    User->>RightSidePanel: discardGetList()
    RightSidePanel->>RightSidePanel: stopPaginationMode()
    RightSidePanel->>RightSidePanel: stopLimitMode()
    RightSidePanel->>BrowserActions: stopGetList()
    BrowserActions->>BrowserActions: set getList = false
    BrowserActions->>Socket: emit 'setGetList' { getList: false }
    BrowserActions->>BrowserActions: set paginationMode = false
    BrowserActions->>Socket: emit 'setPaginationMode' { pagination: false }

Assessment against linked issues

Objective Addressed Explanation
Synchronize socket and local state when stopping "get list" to prevent incorrect highlighting (#555)
Ensure pagination and limit modes are stopped when discarding list capture (#555)

Possibly related PRs

Poem

A socket event hops in the spring,
To keep our states in perfect sync.
The list now stops with just one call,
No highlights stray, no bugs befall.
With every hop, a bug undone—
The rabbit's work is never done! 🐇✨


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 3160ee8474b5f6012294102a4020f74b566f7ac3 and fa34500c3ab6ef06d1097fa127bcf5822fd77f3b.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/context/browserActions.tsx` (2 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* src/context/browserActions.tsx

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4GNG5cbH8wkgTQhCJYL3h88QwifixaJBSKWmjIAHc0ZAcBZnUaejkw2A9sREpIG3wEXBsAZgBGCfRkW0gMRwEBgFZlgDZy7o9/bnxEdXwXSFJcZjQE7AwAejOLjA0YHus7NFpaf0R+5EwUT+CGnqZXBPPIFIqwGh8eAYJgUfxiLzySqIbheNCyZDAjz9SJieD4LCxQ5bSAAYVS6UyABkkKFoYgaK9+LESeS0hkPNBsqF6j0sFiyRSOZAaQz0HiCb9IMjqkpaA84Kh4gk/NJ8F4pJinrxBJFmNLpAwKPAlvRob8HB4zKtlgqngxYJhSMgyA4gY7QthdhUq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kF/IgP8bx4BQKESo9AMDM21qieADB1BGQLiSGajk5p/3AQ9BaShqJlkgFdGyhMPjdCbAIZmsBAGkOAeQ1alC4LfEyNkXB+DUwTW4OvegY0fSIFlO1J4h8u4L3xigLArxKhzXcnfYKSMnhv1UmiJBID6A9RIHaVAVD4DxGkCSdWJBMBehvCQR0w8+CSknv6MoM8t5Bg8F0VRplBHGwepCNoxVgH8RIaEyU3CIFUOkDLcwcsFYARLMrEkasNYlWQPxQRhx9Z8ENsbaKIEzbCQMFbEx9FGIGGXAYN8RSNxbh3BxGO9AgInjAhBHi0F5CwXvCoNQiEXwoVqauI8QUAD68BaCIHGUPOsDZaDjOsnrZCqE6kCDWGMAA7AABgmAwNYWyxgACYAAsOyAAcaxaCnK2QATjeMctYJAtlnOWFshgtALmxAYBMNA9ySA7NWSMiAkBJhrB2SQEgFzbmnIEMsWIEKJjHOOXc05EwdnHLQOc45OzYhbLhesNY+K+5jGBXU8qYxTnLB2TshgYwVDPNiDs65GK7lbPKsirZAgGCxGWBclFsRaBbI5WMAQwKQVQCAuoSZ0zZkxXmXQcZ65VlAA= -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=getmaxun/maxun&utm_content=556):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@RohitR311 RohitR311 requested a review from amhsirak April 25, 2025 17:06
@RohitR311 RohitR311 added the Scope: UI/UX Issues/PRs related to UI/UX label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: UI/UX Issues/PRs related to UI/UX Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Capture text shows list selection highlighting
1 participant