Rendering error when loading entry from JsonPath filter history
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
Not getting a rendering error.
### Actual Behavior
The response view breaks, the whole pane goes blank, showing a single error:
```
Render Failure: Failed to execute 'querySelector' on 'Element': '[data-key="$.data[?(@.some_prop =~ "value")]"]' is not a valid selector.
```
Stack trace (from DevTools):
```
18:27:51.772 › DOMException: Failed to execute 'querySelector' on 'Element': '[data-key="$.data[?(@.some_prop =~ "value")]"]' is not a valid selector.
at file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:78623
at gh (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:24296)
at s6 (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:42448)
at Wbe (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:41270)
at Ic (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:40309)
at H_ (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:36912)
at pc (file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:116:3288)
at file:///opt/Insomnia/resources/app.asar/index-7770d3c9.js:118:34286
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:204:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
```
### Reproduction Steps
1. Search for the query shown in the error (`$.data[?(@.some_prop =~ "value")]`) in JSONPath filter bar, at the bottom of the response view.
2. Open the filter history drop-down (the clock icon)
3. Select the entry, the rendering error occurs as soon as the mouse hovers over the entry.
Is worth noting that it works OK when running the query in the filter bar. The error is exclusive when selecting the history entry.
### Is there an existing issue for this?
- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Additional Information
Actually, selecting some entries trigger the error, not only the one above, some other entries with errors:
- `$.data[?(@.some_prop.includes("value"))]`
- `$.data[[?(@.some_prop === "value")]]"]`
I understand these aren't valid filters, yet I guess no rendering error should happen.
### Insomnia Version
2023.5.7
### What operating system are you using?
Other Linux
### Operating System Version
Linux 6.1.49-1-MANJARO #1 SMP PREEMPT_DYNAMIC Sun Aug 27 23:08:04 UTC 2023 x86_64 GNU/Linu
### Installation method
yay -S insomnia-bin (AUR)
### Last Known Working Insomnia version
???
Contributor guide
Research direction
Reproduce the failure from the JSONPath filter bar by opening the clock history dropdown and hovering or selecting entries containing quoted filters. Start by tracing the response view's filter-history rendering and selector lookup; done means these entries no longer blank the response pane or produce a querySelector error, while valid filters continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100