Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Added a badge to indicate which queries were duplicated, in the "Related Queries" tabs. The badge can be clicked on, to scroll to the first instance of the query, which will be highlighted. The first instance of a duplicated query is not marked with a badge, since it's not technically duplicated yet.
Screenshots
Light theme:
Dark theme:
An example of the badge with a badge for a long query:
Motivation
This feature came from a need to know which queries were duplicated, when looking at the queries for a given http request. Knowing exactly which queries are duplicated can be very useful when attempting to optimize a request with eager loading. Also, know which instance of the query is the first one can help to identify when this query come from and how to prevent further duplication.
There was quite a few issue regarding this problem, and even a few attempt, but it never got fixed. So here I am, throwing my solution into the ring.
Here are a list of the related issue
#603
#786
#1326
And a PR to fix the issue
#1328
Testing
I wanted to write a complete test suite for this feature. However, since this is a front-end only fix, I could not use the regular phpunit framework. I would have needed to install jest, and setup everything needed to even be able to run a single test. I felt like this was not my place, and I did not want to do more than necessary on that feature.
If, at some point, a testing framework is added to the front-end part of telescope, I will gladly come back and write some tests.