feat : display_chart locale-aware dates and state row filters#741
Open
nehaaprasaad wants to merge 1 commit intogetnao:mainfrom
Open
feat : display_chart locale-aware dates and state row filters#741nehaaprasaad wants to merge 1 commit intogetnao:mainfrom
nehaaprasaad wants to merge 1 commit intogetnao:mainfrom
Conversation
Contributor
🚀 Preview Deployment
Preview will be automatically removed when this PR is closed. |
Contributor
There was a problem hiding this comment.
2 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/shared/src/story-segments.ts">
<violation number="1" location="apps/shared/src/story-segments.ts:72">
P2: Unvalidated `date_locale` can propagate an invalid locale into `toLocaleDateString`, which may throw at render time.</violation>
</file>
<file name="apps/frontend/src/components/tool-calls/display-chart.tsx">
<violation number="1" location="apps/frontend/src/components/tool-calls/display-chart.tsx:349">
P2: Unvalidated `date_locale` is forwarded into shared date formatting, which can throw on invalid locale strings and break chart rendering.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| const filterStateTypes = tryParseStringArray(attrs.filter_state_types); | ||
| const filterStateNames = tryParseStringArray(attrs.filter_state_names); | ||
| const dateLocale = attrs.date_locale?.trim() || undefined; |
Contributor
There was a problem hiding this comment.
P2: Unvalidated date_locale can propagate an invalid locale into toLocaleDateString, which may throw at render time.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/shared/src/story-segments.ts, line 72:
<comment>Unvalidated `date_locale` can propagate an invalid locale into `toLocaleDateString`, which may throw at render time.</comment>
<file context>
@@ -52,13 +67,20 @@ export function parseChartBlock(attrString: string): ParsedChartBlock | null {
+ const filterStateTypes = tryParseStringArray(attrs.filter_state_types);
+ const filterStateNames = tryParseStringArray(attrs.filter_state_names);
+ const dateLocale = attrs.date_locale?.trim() || undefined;
+
return {
</file context>
| series: visibleSeries, | ||
| colorFor, | ||
| labelFormatter: xAxisLabelFormatter, | ||
| dateLocale: chartDateLocale, |
Contributor
There was a problem hiding this comment.
P2: Unvalidated date_locale is forwarded into shared date formatting, which can throw on invalid locale strings and break chart rendering.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/frontend/src/components/tool-calls/display-chart.tsx, line 349:
<comment>Unvalidated `date_locale` is forwarded into shared date formatting, which can throw on invalid locale strings and break chart rendering.</comment>
<file context>
@@ -314,6 +346,7 @@ export const ChartDisplay = memo(function ChartDisplay({
series: visibleSeries,
colorFor,
labelFormatter: xAxisLabelFormatter,
+ dateLocale: chartDateLocale,
showGrid,
margin: { top: 0, right: 0, bottom: 0, left: 0 },
</file context>
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.
summary
Changes
Test plan
fix : #734