I am using the Syncfusion `GanttComponent` with virtualization enabled (`enableVirtualization` and `enableTimelineVirtualization`). While it works most of the time, I occasionally encounter the following error, which causes the Gantt chart and table to remain stuck in the skeleton state:
```
Uncaught runtime errors:
×
ERROR
Cannot read properties of undefined (reading 'isRowSelected')
TypeError: Cannot read properties of undefined (reading 'isRowSelected')
at VirtualTreeContentRenderer.scrollListeners (http://localhost:3000/static/js/bundle.js:609070:242)
at http://localhost:3000/static/js/bundle.js:608788:24
at later (http://localhost:3000/static/js/bundle.js:530038:28)
```
Below is the relevant part of my Gantt configuration:
```jsx
import { L10n, loadCldr, setCulture } from "@syncfusion/ej2-base";
import { DayMarkers, GanttComponent, Inject, VirtualScroll } from "@syncfusion/ej2-react-gantt";
const Gantt = forwardRef((props, ref) => {
const settings = useMemo(function settings() {
return {
allowSelection: false,
baselineColor: "red",
columns: [
{
autoFit: true,
field: "title",
headerTemplate,
isPrimaryKey: true,
template: template("title"),
visible: true,
width: "500px",
},
//rest columns
],
connectorLineBackground: "#7e7e7e",
connectorLineWidth: 3,
dataBound: handleDataBound,
eventMarkers: [
{
day: new Date(),
label: tProjectSchedule("Today"),
},
],
gridLines: "Both",
highlightWeekends: true,
labelSettings: {
leftLabel: "",
rightLabel: function rightLabel(data) {
return data.taskData.assignees.map((assignee) => assignee.name).join(", ");
},
taskLabel: "${taskData.progressTaskLabel}%",
},
locale,
milestoneTemplate: () => {
// code
},
onTaskbarClick: (event) => {
//code
},
queryTaskbarInfo,
ref,
renderBaseline: true,
enableVirtualization: true,
enableTimelineVirtualization: true,
rowDataBound,
splitterSettings: computeSplitterSettings(fullscreenMode, columns, view),
taskFields: {
baselineEndDate: "baselineEndDate",
baselineStartDate: "baselineStartDate",
child: "child",
dependency: "dependency",
duration: "duration",
id: "id",
indicators: "indicators",
name: "name",
progress: "progress",
startDate: "startDate",
},
taskMode: "Manual",
timelineSettings: computeTimelineSettings(timelineViewMode),
tooltipSettings: {
showTooltip: true,
},
width: "100%",
workWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
};
}, [dateFormat]);
return (
<Box
sx={{
display: "flex",
flexDirection: "row",
flexGrow: 1,
overflow: "hidden",
width: "100%",
}}
>
<GanttComponent {...settings}>
<Inject services={[DayMarkers, VirtualScroll]} />
</GanttComponent>
</Box>
);
})
```
Has anyone else faced this issue? Could this be related to the library version, or am I missing something in my configuration?
Any suggestions to resolve this would be highly appreciated! Thank you.
Hi Pradeep,
Greetings from Syncfusion Support,
We have reviewed the shared details. And we have prepared sample shared
details based and tested our sample, we were unable to replicate the reported
issue. For your reference, we have attached a video demonstrating our
observations.
Video reference as zip file refer it.
We request you to share more information to achieve your requirement.
Kindly share the details below.
Sample link: https://stackblitz.com/edit/react-rxj9fu-esgpgm?file=index.js,package.json,data.js
Once we receive this information, we will be better equipped to identify the root cause of the issue and provide you with the necessary assistance.
Regards,
Ajithkumar G
Hi Ajith,
Thank you for your response. I am sharing the code and library versions via StackBlitz. Please have a look at this. I am also attaching a video for your reference. This bug is not frequently reproducible; sometimes it shows the bug, but most of the time it works, as you can see in the screencast.
We have a lot of data, so this might be the reason. Can you guide me on how to optimize the code so it will load faster or how to resolve this bug?
StackBlitz link: https://stackblitz.com/edit/react-ohtyab-d3wdgn?file=index.js
Thank you for your time.
Regards,
Pradeep
Hi Pradeep,
Greetings from Syncfusion Support,
We can occasionally replicate the problem, but we haven't been able to find the
exact replication steps on our end. We need more time to validate the issue and
will share the details on or before December 9, 2024.
Regards,
Ajithkumar G
Hi Ajith,
Sure. Thank you
Regards,
Pradeep
Hi Pradeep,
We appreciate your
patience.
We can replicate the problem our end. We have logged this reported
issue, ‘Console Error thrown when scrolling in virtualization sample
with allowSelection set to false' as a bug. We are working on a fix for this
issue and plan to include it in our upcoming patch release which is scheduled
to be rolled out on Dec 31, 2024. You can track its status from the feedback
link given below.
You can track the progress of the resolution by
visiting the feedback link provided below:
Feedback link: https://www.syncfusion.com/feedback/63823/console-error-thrown-when-scrolling-in-virtualization-sample-with-allowselection
Disclaimer: Inclusion of this solution in the main release may
change due to other factors including but not limited to QA checks and works
reprioritization.
Regards,
Ajithkumar G
Hi Ajithkumar,
Thank you for the update.
We appreciate your prompt acknowledgment of the issue. We will track the progress using the feedback link you have shared.
Looking forward to the upcoming patch release.
Regards,
Pradeep.
Hi Pradeep,
We appreciate your patience.
We are glad to announce that our patch release (v28.1.36) is rolled out
successfully. In this release, we have added the fix for the reported issue.
Please upgrade to the latest
version packages to resolve this issue “Console Error thrown when scrolling in
virtualization sample with allowSelection set to false".
Root Cause: The undefined error occurred because the isRowSelected property was
accessed from an unavailable selection module.
Sample link: https://stackblitz.com/edit/react-rxj9fu-rblcnyqa?file=index.js,package.json,data.js
Release notes: https://ej2.syncfusion.com/documentation/release-notes/28.1.36?type=all#ganttchart
Contact us if you require any further assistance.
Regards,
Ajithkumar G
Hi Ajithkumar,
Thank you for the prompt update.
I appreciate the efforts taken to resolve the issue and for providing detailed insights, including the root cause and the sample link. I will upgrade to the latest version (v28.1.36) and verify the fix on my end.
If I encounter any further issues, I will reach out for assistance.
Thanks again for your support.
Best regards,
Pradeep
Hi Ajithkumar,
I have upgraded the library and tried it. After 15–20 minutes of scrolling, I was able to reproduce the error again. I don’t think the issue has been fixed. I have attached a screenshot for your reference. Could you please look into this once again?
Thank you,
Best regards,
Pradeep
Hi Pradeep,
We have tried the shared details on our end but were unable to replicate the
issue. The reported problem was observed in an earlier version but does not
occur in version 28.1.36 or later. We have attached a sample for reference.
Sample link: https://stackblitz.com/edit/react-rxj9fu-hkvjye6f?file=index.js,package.json,data.js
Based on our analysis, the issue might be caused by duplicate packages in your
application. To address this, please follow these steps:
If the issue persists after
completing these steps, please modify the attached sample to replicate the
problem and share it with us for further validation.
Regards,
Ajithkumar G
Hi Ajithkumar G,
I have tried all the steps you mentioned, but I am still facing the same issue. I am using the following versions of React and React DOM. Could these be causing the problem? Additionally, I am unable to reproduce this issue in the provided sample link.
"react": "^17.0.2",
"react-dom": "^17.0.2"
Best regards,
Pradeep
Hi Pradeep,
We have shared details based on the React version and prepared a local sample
to ensure the reported case. However, we were unable to replicate the issue on
our end. Please refer to the attached sample for reference.
Using the attached sample, kindly replicate the issue and share the replication steps along with a video for validation on our end.
Additionally, we need more information, including the full code of the Gantt chart, package and theme version details, and the package.json file for validation. Please provide these details, and we will ensure further investigation and share our findings.
The attached sample is included as a zip file.
Regards,
Ajithkumar G
Hi Ajithkumar G,
I am attaching a sample project that includes all the required packages with their respective versions. However, when I try to run this project, sometimes it only shows a scrolling window without any data (I have attached a screenshot for your reference), and other times, it displays a blank white screen while scrolling.
Could you please take a look into this?
Thank you,
Best regards,
Pradeep
Attachment: virtualScroll_921b964a.zip
Hi Pradeep,
Thank your for the shared details.
We have reviewed the details and were able to replicate the reported issue
using the shared sample. We would like to clarify the behavior of the Gantt
chart.
When virtualization is enabled without specifying the height, the scroll functionality does not work properly in the attached sample. This is because virtualization requires a specified height to render records within the viewport.
We have attached a modified sample and a UG document for reference.
|
// before code return { ... width: "100%", };
}, return { ... height:"450px", width: "100%", }; }, |
Sample attached as zip file.
For more information, you may refer to the
following link:
https://ej2.syncfusion.com/react/documentation/gantt/virtual-scroll#row-virtualization
https://ej2.syncfusion.com/react/documentation/gantt/virtual-scroll#limitations-for-virtual-scroll
Please contact us if you need any further assistance
Regards,
Ajithkumar G
Hi Ajithkumar G,
Thank you for the quick response and the assistance you provided. I have added the height prop to the GanttComponent, which solved the above issue along with the Console Error thrown when scrolling.... Thanks again!
Best regards,
Pradeep
Hi Pradeep,
You're welcome! Glad that the provided solution was helpful. If you have any other questions, please reach out to us, we will be happy to help you.
Regards,
Kalpana.