Merged
Conversation
Contributor
There was a problem hiding this comment.
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
preserveCategoryOrderon 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. |
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.
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.