Skip to content

Fix: Search functionality in the body tab#1335

Merged
cortinico merged 2 commits into
ChuckerTeam:mainfrom
iamarjun:search_crash_fix
Jan 3, 2025
Merged

Fix: Search functionality in the body tab#1335
cortinico merged 2 commits into
ChuckerTeam:mainfrom
iamarjun:search_crash_fix

Conversation

@iamarjun

@iamarjun iamarjun commented Jan 3, 2025

Copy link
Copy Markdown
Contributor

This commit addresses and fixes the search functionality in the body (issue reference) tab by:

  • Including all items in the search instead of filtering only body line items.
  • Correcting the index used for search and highlighting.
  • Clearing spans when the query string is not found.
  • Resetting highlight on all items.

These changes ensure that the search works correctly and highlights the correct lines in the body tab.

📷 Screenshots

output.mp4

📄 Context

📝 Changes

📎 Related PR

🚫 Breaking

🛠️ How to test

⏱️ Next steps

This commit fixes the search functionality in the body tab by:

- Including all items in the search instead of filtering only body line items.
- Correcting the index used for search and highlighting.
- Clearing spans when the query string is not found.
- Resetting highlight on all items.

These changes ensure that the search works correctly and highlights the correct lines in the body tab.
@iamarjun iamarjun requested a review from a team as a code owner January 3, 2025 09:48
@iamarjun

iamarjun commented Jan 3, 2025

Copy link
Copy Markdown
Contributor Author

backgroundSpanColor,
foregroundSpanColor,
)
println("listOfSearchQuery: $listOfSearchQuery")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamarjun, please remove println

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This commit removes a print statement that was used for debugging purposes. The print statement was located in the `TransactionPayloadFragment` class and was used to print the value of the `listOfSearchQuery` variable.
@iamarjun iamarjun requested a review from A7ak January 3, 2025 10:00

@cortinico cortinico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending this over

foregroundColor: Int,
): List<SearchItemBodyLine> {
val listOfSearchItems = arrayListOf<SearchItemBodyLine>()
items.filterIsInstance<TransactionPayloadItem.BodyLineItem>()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you removed this?

@iamarjun iamarjun Jan 3, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since TransactionPayloadItem have mutliple types, filtering the BodyLineItem subtype and then indexing them does't really give us the actual index of the item in the whole list. As a result wrong line with wrong search query gets highlighted, also the primary reason for the crash as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I understand. Thanks for clarifying 👍

foregroundColor: Int,
): List<SearchItemBodyLine> {
val listOfSearchItems = arrayListOf<SearchItemBodyLine>()
items.filterIsInstance<TransactionPayloadItem.BodyLineItem>()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I understand. Thanks for clarifying 👍

@cortinico cortinico enabled auto-merge (squash) January 3, 2025 13:15
@cortinico cortinico merged commit 66da10c into ChuckerTeam:main Jan 3, 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.

3 participants