Skip to content

Commit 1b08957

Browse files
fix(explore): Reset aggregate cursor on filter changes (#120200)
When Explore's shared query-params context applies a new filter, it already marks both pagination cursors for reset. The spans URL writer handled the samples cursor but ignored `aggregateCursor`, leaving aggregate mode on a stale page and potentially showing an empty result set. This change writes the aggregate cursor through the same nullable URL helper, so a query change removes it and returns aggregate results to page one. It also adds regression coverage for clearing a populated aggregate cursor while applying a filter. Closes EXP-1111 --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Nicholas Deschenes <nicholas.deschenes@sentry.io>
1 parent d4803b0 commit 1b08957

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

static/app/views/explore/spans/spansQueryParams.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,20 @@ describe('getReadableQueryParamsFromLocation', () => {
404404
});
405405

406406
describe('getTargetWithReadableQueryParams', () => {
407+
it('removes the aggregate cursor when it is reset', () => {
408+
const location = locationFixture({aggregateCursor: '0:50:0'});
409+
410+
const initialTarget = getTargetWithReadableQueryParams(location, {});
411+
expect(initialTarget.query).toEqual({aggregateCursor: '0:50:0'});
412+
413+
const target = getTargetWithReadableQueryParams(location, {
414+
aggregateCursor: null,
415+
query: 'span.name:checkout',
416+
});
417+
418+
expect(target.query).toEqual({query: 'span.name:checkout'});
419+
});
420+
407421
it('writes breakdown query params', () => {
408422
const location = locationFixture({});
409423
const target = getTargetWithReadableQueryParams(location, {

static/app/views/explore/spans/spansQueryParams.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ export function getTargetWithReadableQueryParams(
150150
)
151151
);
152152

153+
updateNullableLocation(
154+
target,
155+
SPANS_AGGREGATE_CURSOR,
156+
writableQueryParams.aggregateCursor
157+
);
153158
updateNullableLocation(
154159
target,
155160
SPANS_AGGREGATE_FIELD_KEY,

0 commit comments

Comments
 (0)