Skip to content

Yash code - #3

Merged
yashcoddee merged 9 commits into
developmentfrom
yash-code
Jul 14, 2026
Merged

Yash code#3
yashcoddee merged 9 commits into
developmentfrom
yash-code

Conversation

@yashcoddee

Copy link
Copy Markdown
Collaborator

No description provided.

@yashcoddee
yashcoddee merged commit c34e945 into development Jul 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new D3-based BarChartWidget component, updates chart themes, adds a StreamWidget for data streaming, and integrates the bar chart into the test application. Key feedback highlights a critical case-sensitivity bug in StreamWidget (NewNode vs newNode) and a validation key mismatch in BarChartWidget. Other recommendations include avoiding syncing props to state, removing unused imports and helper functions, cleaning up debug console logs, handling dummy data regeneration when limits change, and renaming the Bar Chart folder to eliminate spaces.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


const anedya = (client as any)._anedya as Anedya;

const node = anedya.NewNode(client, nodeId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

There is a case-sensitivity mismatch when calling NewNode. In other components (like ChartWidget.tsx and BarChartWidgets.tsx), the method is called newNode (lowercase 'n'). Calling anedya.NewNode will likely result in a runtime TypeError because the method does not exist on the SDK client.

Suggested change
const node = anedya.NewNode(client, nodeId);
const node = anedya.newNode(client, nodeId);

Comment on lines +147 to +151
validateRequiredProps(
"Bar Chart Widget",
{ client, nodeId, variable, from, to },
["client", "nodeId", "variable", "from time", "to time"]
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The keys in the object passed to validateRequiredProps do not match the strings in the required array. The object has keys from and to, but the required array lists "from time" and "to time". This will cause the validation helper to always report these props as missing even when they are correctly provided.

Suggested change
validateRequiredProps(
"Bar Chart Widget",
{ client, nodeId, variable, from, to },
["client", "nodeId", "variable", "from time", "to time"]
);
validateRequiredProps(
"Bar Chart Widget",
{ client, nodeId, variable, from, to },
["client", "nodeId", "variable", "from", "to"]
);

Comment on lines +196 to +200
useEffect(() => {
if (dataProp) {
setData(dataProp);
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Syncing dataProp to state data inside useEffect is an anti-pattern in React. Since dataProp is an array, passing it directly in the dependency array of useEffect can cause infinite render loops or unnecessary effect executions if the parent component passes an unmemoized array literal. Consider deriving data directly during render (e.g., const data = dataProp ?? fetchedData;) instead of duplicating it in state.

Comment on lines +103 to +104
const toDateSafe = (ts: number): Date =>
ts < 1e12 ? new Date(ts * 1000) : new Date(ts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The helper function toDateSafe is defined here but is never used anywhere in this file. Removing unused helper functions keeps the codebase clean and maintainable.

Comment on lines +4 to +8
import {
defaultDateFormatter,
formatDate,
formatNumber,
} from "../../helpers/formatDate";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The imports defaultDateFormatter and formatDate are imported from ../../helpers/formatDate but are never used in this file. Only formatNumber is used. Removing unused imports improves maintainability.

import {
  formatNumber,
} from "../../helpers/formatDate";

Comment on lines +35 to +36
console.log("Stream Node : ", node);
console.log(Object.getOwnPropertyNames(Object.getPrototypeOf(node)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Avoid leaving debug console.log statements in production-ready components as they clutter the consumer's console. Consider removing them or replacing them with a proper logging utility.

setData(dataProp);
return;
}
if (!usingRealClient || !node) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When usingRealClient is false (i.e., using dummy data), the useEffect returns early because of if (!usingRealClient || !node) return;. This means that if the limit prop changes, the dummy data will not be regenerated to match the new limit. Consider handling dummy data regeneration when limit changes.

Comment thread test/my-app/src/App.jsx
LatestDataGauge,
} from "../../../src/index";

import { BarChartWidget } from "../../../src/components/Bar Chart/BarChartWidgets";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The folder name Bar Chart contains a space. Using spaces in folder or file names is discouraged in JavaScript/TypeScript projects as it can cause issues with terminal commands, module resolution, and build tools. Consider renaming the folder to bar-chart or BarChart.

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