Skip to content

Fix GraphSection type error in build#487

Open
ngoiyaeric wants to merge 3 commits intofeature/generative-graphs-ui-data-preview-17358342468692938721from
fix-graph-section-type-error-3486905341998850719
Open

Fix GraphSection type error in build#487
ngoiyaeric wants to merge 3 commits intofeature/generative-graphs-ui-data-preview-17358342468692938721from
fix-graph-section-type-error-3486905341998850719

Conversation

@ngoiyaeric
Copy link
Collaborator

@ngoiyaeric ngoiyaeric commented Feb 3, 2026

User description

The GraphSection component's result prop was too strictly typed to StreamableValue, causing a build failure in app/actions.tsx during chat hydration where tool outputs are passed as StreamableValue (JSON). This change expands the prop type to include StreamableValue, which the component already handles correctly in its internal logic.


PR created automatically by Jules for task 3486905341998850719 started by @ngoiyaeric


PR Type

Bug fix


Description

  • Expand GraphSection result prop type to accept StreamableValue

  • Resolves type mismatch when tool outputs passed as JSON strings

  • Maintains backward compatibility with existing DataAnalysisResult types


Diagram Walkthrough

flowchart LR
  A["GraphSectionProps.result"] -- "added support for" --> B["StreamableValue<string>"]
  A -- "existing support" --> C["DataAnalysisResult"]
  A -- "existing support" --> D["StreamableValue<DataAnalysisResult>"]
  B -- "handles JSON tool outputs" --> E["Chat hydration"]
Loading

File Walkthrough

Relevant files
Bug fix
graph-section.tsx
Add StreamableValue to result prop type                   

components/graph-section.tsx

  • Extended result prop type definition to include StreamableValue
  • Allows component to accept tool outputs as JSON strings wrapped in
    StreamableValue
  • Fixes build failure in app/actions.tsx during chat hydration
  • Component's internal logic already handles this type correctly
+1/-1     

…e<string>

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@charliecreates charliecreates bot requested a review from CharlieHelps February 3, 2026 14:38
@vercel
Copy link
Contributor

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qcx Canceled Canceled Feb 3, 2026 3:43pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-graph-section-type-error-3486905341998850719

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Feb 3, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
String stream handling: The expanded result type now explicitly allows StreamableValue<string> but the diff
does not show how invalid/empty/non-JSON string payloads are handled, so robustness
against malformed tool output cannot be verified from the change.

Referred Code
interface GraphSectionProps {
  result: DataAnalysisResult | string | StreamableValue<DataAnalysisResult> | StreamableValue<string>
}

export function GraphSection({ result }: GraphSectionProps) {
  if (!result) return null;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Input validation unclear: By accepting StreamableValue<string> for result, the component may consume
externally produced JSON strings, but the diff does not show validation/sanitization of
this string input before use, so secure handling cannot be confirmed.

Referred Code
  result: DataAnalysisResult | string | StreamableValue<DataAnalysisResult> | StreamableValue<string>
}

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Feb 3, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Unwrap streamable before checks

Use useStreamableValue(result) to unwrap the result prop before performing type
checks to prevent misclassifying the data type.

components/graph-section.tsx [40-42]

-const isStatic = typeof result === 'object' && result !== null &&
-  ('chartType' in (result as any) || 'title' in (result as any) || 'data' in (result as any));
-const isString = typeof result === 'string';
+const resolved = useStreamableValue(result);
+const isStatic = typeof resolved === 'object' && resolved !== null &&
+  ('chartType' in resolved || 'title' in resolved || 'data' in resolved);
+const isString = typeof resolved === 'string';

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: This suggestion correctly identifies a bug where type checks are performed on the StreamableValue wrapper instead of its resolved value, which would cause incorrect behavior for the newly added StreamableValue<string> type.

Medium
General
Simplify the prop type definition

Simplify the result prop's type definition by combining StreamableValue and
StreamableValue into StreamableValue<DataAnalysisResult | string>.

components/graph-section.tsx [32]

-result: DataAnalysisResult | string | StreamableValue<DataAnalysisResult> | StreamableValue<string>
+result: DataAnalysisResult | string | StreamableValue<DataAnalysisResult | string>
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: This is a valid suggestion that simplifies the type definition for the result prop by combining two StreamableValue types, which improves code readability and maintainability.

Low
  • Update

Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

  • The prop type expansion is correct per context, but the current runtime narrowing (isStatic) relies on any + key probing, which can misclassify StreamableValue<string> (or other opaque wrappers) as a DataAnalysisResult.
  • Consider replacing the probe with a stricter type guard to prevent wrapper-shape collisions and reduce reliance on any.
Additional notes (1)
  • Maintainability | components/graph-section.tsx:35-35
    isStatic uses (result as any) and then probes keys with in. This is now even more brittle because result can be StreamableValue<string> (an object) and could accidentally satisfy the 'title' in ... check depending on the streamable wrapper shape, causing the component to treat a stream wrapper as a DataAnalysisResult. That would be a correctness bug (misclassification) rather than just a typing issue.

Since this PR broadens the input types, it’s a good moment to make the narrowing more robust without relying on any.

Summary of changes

What changed

  • Expanded GraphSectionProps.result to accept an additional type: StreamableValue<string>.
    • Before: DataAnalysisResult | string | StreamableValue<DataAnalysisResult>
    • After: DataAnalysisResult | string | StreamableValue<DataAnalysisResult> | StreamableValue<string>

Why

  • Aligns GraphSection’s public prop typing with actual runtime usage during chat hydration, where tool outputs can be streamed as JSON strings (StreamableValue<string>), preventing a build failure in app/actions.tsx.

1. Fix type error in `app/actions.tsx`: Expanded `GraphSectionProps` to support `StreamableValue<string>` for hydrated tool outputs.
2. Fix random refreshes in `components/chat.tsx`: Implemented `lastRefreshedMessageIdRef` to ensure `router.refresh()` is called exactly once per unique AI response, preventing infinite loops and unintended reloads.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
1. Fix type error in `app/actions.tsx`: Expanded `GraphSectionProps` to support `StreamableValue<string>` for hydrated tool outputs.
2. Fix infinite/random refreshes in `components/chat.tsx`:
   - Implemented `lastRefreshedMessageIdRef` to ensure `router.refresh()` is called exactly once per AI response.
   - Removed nested `MapDataProvider` shadowing, which was resetting map state on every `Chat` re-render.
3. Fix map re-initialization in `components/map/mapbox-map.tsx`: Adjusted `useEffect` dependencies to prevent destroying and recreating the Mapbox instance during camera movements.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – qcx February 3, 2026 15:43 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants