Skip to content

fix: leaderboard columns going stale when context is shown for all measures - #9807

Open
nishantmonu51 wants to merge 1 commit into
mainfrom
nishant/fix-leaderboard-context-columns
Open

fix: leaderboard columns going stale when context is shown for all measures#9807
nishantmonu51 wants to merge 1 commit into
mainfrom
nishant/fix-leaderboard-context-columns

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator
  • The leaderboard's colgroup, header and rows each called a locally declared shouldShowContextColumns() to decide which context columns to render. In Svelte 5 legacy mode that call only re-evaluates when the identifiers in the expression change, so the prop it reads is never tracked and the block goes stale until the component is remounted.
  • Toggling "show context for all measures" with a time comparison active therefore updated the rows (they remount when the query refetches) but not the colgroup or the header: the body rendered delta columns the table never declared, measure labels slid onto the previous measure's delta columns, and the surplus cells collapsed into overlapping text at the right edge. A page reload rendered it correctly, which is why it only showed up after toggling.
  • Leaderboard.svelte now derives measuresWithContext reactively and passes it to LeaderboardHeader and LeaderboardRow, so all three stay in sync.
  • Also fixes columnCount, which counted percent-of-total from the sort measure only, and tableWidth, which only ever counted a single measure's columns.
  • Added LeaderboardHeader.spec.ts, which fails against the old function-based header (one delta column instead of two) and passes now.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

…asures

The colgroup, header and rows each decided which context columns to render
by calling a locally declared shouldShowContextColumns(). In Svelte 5
legacy mode such a call only re-evaluates when the identifiers in the
expression change, so the prop it reads is never tracked and the block
goes stale until the component is remounted.

Toggling "show context for all measures" therefore updated the rows (they
remount when the query refetches) but not the colgroup or the header: the
body rendered delta columns the table never declared, measure labels slid
onto the previous measure's delta columns, and the surplus cells collapsed
into overlapping text at the right edge.

Derive the set of measures with context reactively in Leaderboard.svelte
and pass it to the header and rows, so all three stay in sync. Along the
way, fix columnCount, which counted percent-of-total from the sort measure
only, and tableWidth, which only ever counted a single measure's columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant