Fix realtime top stats in limited to segment shared link#6341
Closed
RobertJoonas wants to merge 1 commit into
Closed
Fix realtime top stats in limited to segment shared link#6341RobertJoonas wants to merge 1 commit into
RobertJoonas wants to merge 1 commit into
Conversation
apata
reviewed
May 11, 2026
| }) | ||
|
|
||
| currentVisitorsQuery.filters = [] | ||
| const filters = limitedToSegmentId |
Contributor
There was a problem hiding this comment.
issue, blocking: This changes the meaning of "Current visitors" top stats block depending on whether the user accesses the dashboard using shared link limited to segment or normally, with the same segment applied.
Contributor
Author
There was a problem hiding this comment.
Yeah, the decision was to keep the current behaviour where current visitors ignore all filters (including enforced segment). That's now done in #6351, where I've switched current visitors back to the dedicated /current-visitors endpoint. Closing this PR in favour of 6351.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
Currently the realtime Top Stats are broken in shared links that are limited to a segment. Precisely, the "current visitors" query is what the backend rejects --
StatsControllerenforces a segment filter via a plug, but the FE simply strips all filters from this query (including the enforced segment one).Previous behaviour was to skip the plug and allow the current visitors query without the "limited to segment" filter, therefore returning data that is completely out of scope for the given dashboard. Instead of sticking to that behaviour and building an additional flag and ignore it in the new
/queryendpoint too, I've made the new current visitors metric respect the segment filter. It now removes all other filters except the limited segment one.Note: This is a quick and dirty fix. I've made some good progress with improving the API v2 interface on the frontend. Planning to have currentVisitors apiState available via a new context (so that the response could be used wherever necessary, i.e. in top stats or the top-bar). That allows us to keep top-stats itself to a single query, with a solid Tanstack QueryKey, etc...
The tests will therefore change too.
Tests
Changelog
Documentation
Dark mode