Skip to content

Clean up streaming category ordering#850

Merged
emeeks merged 5 commits intomainfrom
streaming-category-order
Apr 19, 2026
Merged

Clean up streaming category ordering#850
emeeks merged 5 commits intomainfrom
streaming-category-order

Conversation

@emeeks
Copy link
Copy Markdown
Member

@emeeks emeeks commented Apr 18, 2026

Category ordering jumped around too much when using the streaming data api in charts so this creates an auto mode that has the value-ordering in static but the first-in ordering in streaming.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes ordinal category ordering under streaming and “aggregator-style” updates by introducing an "auto" sort mode and a bounded-replacement path that preserves category insertion-order memory.

Changes:

  • Add oSort: "auto" to preserve insertion order while streaming, but sort by value-desc on static/bounded data.
  • Add preserveCategoryOrder on bounded changesets and a new adapter replacement method to support aggregator HOCs (e.g., Likert) without category shuffling.
  • Add regression tests for StreamOrdinalFrame / OrdinalPipelineStore and an end-to-end Likert streaming ordering test.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/components/stream/types.ts Extends Changeset with preserveCategoryOrder flag for bounded replacements.
src/components/stream/ordinalTypes.ts Adds "auto" to ordinal oSort typing/docs.
src/components/stream/StreamOrdinalFrame.tsx Routes replace() through a new replacement ingest path preserving category order.
src/components/stream/StreamOrdinalFrame.test.tsx Adds regression test ensuring replace() preserves insertion order across value swaps.
src/components/stream/OrdinalPipelineStore.ts Implements preserveCategoryOrder handling + "auto" sort resolution.
src/components/stream/OrdinalPipelineStore.test.ts Adds tests for preserveCategoryOrder and sort="auto" semantics.
src/components/stream/DataSourceAdapter.ts Adds setReplacementData() emitting bounded changesets with preserveCategoryOrder.
src/components/charts/shared/hooks.ts Updates useSortedData to accept "auto" (no-op sorting).
src/components/charts/ordinal/StackedBarChart.tsx Extends sort prop type to include "auto" (forwarded to frame).
src/components/charts/ordinal/GroupedBarChart.tsx Extends sort prop type to include "auto" (forwarded to frame).
src/components/charts/ordinal/BarChart.tsx Extends sort prop type to include "auto".
src/components/charts/ordinal/DotPlot.tsx Defaults sort to "auto" to avoid shuffling in push/streaming usage.
src/components/charts/ordinal/DotPlot.test.tsx Updates expectation for DotPlot default sort to "auto".
src/components/charts/ordinal/LikertChart.tsx Exposes getScales() on the ref handle for order verification/debug.
src/components/charts/ordinal/LikertChart.streaming-order.test.tsx New end-to-end test locking down Likert streaming category order stability.

Comment thread src/components/stream/OrdinalPipelineStore.ts
Comment thread src/components/stream/DataSourceAdapter.ts
Comment thread src/components/stream/StreamOrdinalFrame.tsx
Comment thread src/components/charts/shared/hooks.ts Outdated
Comment thread src/components/charts/ordinal/LikertChart.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 39 changed files in this pull request and generated 8 comments.

Comment thread src/components/charts/ordinal/StackedBarChart.tsx Outdated
Comment thread src/components/charts/ordinal/GroupedBarChart.tsx Outdated
Comment thread src/components/stream/ordinalTypes.ts Outdated
Comment thread src/components/stream/ordinalTypes.ts Outdated
Comment thread src/components/charts/ordinal/DotPlot.tsx Outdated
Comment thread src/components/charts/ordinal/DotPlot.tsx Outdated
Comment thread src/components/charts/ordinal/BarChart.tsx Outdated
Comment thread src/components/charts/ordinal/LikertChart.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 39 changed files in this pull request and generated 5 comments.

Comment thread src/components/stream/ordinalTypes.ts Outdated
Comment thread src/components/stream/ordinalTypes.ts Outdated
Comment thread src/components/charts/ordinal/BarChart.tsx
Comment thread src/components/stream/DataSourceAdapter.ts
Comment thread src/components/stream/StreamOrdinalFrame.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.

Comment thread src/components/stream/OrdinalPipelineStore.ts Outdated
@emeeks emeeks merged commit 551857f into main Apr 19, 2026
5 checks passed
@emeeks emeeks deleted the streaming-category-order branch April 26, 2026 22:25
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.

2 participants