fix(discover2): Properly sync minigraphs of pre-built queries with the global selection header#15868
Conversation
| } | ||
|
|
||
| static fromSavedQuery(saved: NewQuery | LegacySavedQuery): EventView { | ||
| static fromSavedQuery(saved: NewQuery | SavedQuery): EventView { |
There was a problem hiding this comment.
You could remove the isLegacySavedQuery() conditions too.
| }); | ||
| }); | ||
|
|
||
| it('new query takes precedence over global selection values', function() { |
There was a problem hiding this comment.
Could this result in the global header saying one thing but the result set being for a different range? How do we sync those up?
There was a problem hiding this comment.
@markstory Good question. Right now, I've meant EventView.fromNewQueryWithLocation() to be only used for pre-built queries; which at the moment, do not have statsPeriod baked in. But I've written code in the case if a decision was made to bake statsPeriod in the upcoming weeks.
This merging strategy is used for the "Build a new query" CTA, and as well as for the query cards CTA for pre-built queries (and their minigraphs).
This is primarily for the queries we display on the landing page; since the global header is accessible to the user on this page. In other words, changing the values on the global header should be reflected to the minigraphs on the prebuilt query cards.
Regarding your concerns in sync'ing of the global header and the query, we already ensure that EventView.fromLocation() is the source of truth for the query builder view.
For saved queries, any values they may have will override the global selection values (this is what EventView.fromSavedQuery() does).
ad5348b to
38231fb
Compare
This only applies to pre-built queries; saved queries are still disconnected.
I've renamed
EventView.fromSavedQueryWithLocation()toEventView. fromNewQueryWithLocation(), and refined some TS types.TODO
isLegacySavedQuery()