Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datagrid fails to render if added to virtual dom #5471

Closed
1 of 2 tasks
marienellagallo opened this issue Jun 11, 2024 · 3 comments
Closed
1 of 2 tasks

Datagrid fails to render if added to virtual dom #5471

marienellagallo opened this issue Jun 11, 2024 · 3 comments
Assignees
Labels
component: Datagrid Sev 3 Visible or noticeable to users but does not impede functionality. Has a workaround. status: waiting for author 💬 type: bug 🐛 Something isn't working

Comments

@marienellagallo
Copy link
Contributor

Package

Carbon for IBM Products

Description

Edge case that we see in SOAR when rendering Datagrid using virtual DOM.

const tableDomNode = document.createElement('div');
ReactDOM.render(, tableDomNode); // renders Datagrid with data

Component(s) impacted

Datagrid fails to render and an error is shown in console logs
chunk-OK4P3QOP.js?v=41e20ba8:3748 Uncaught TypeError: Cannot read properties of null (reading 'querySelector')
image

Browser

No response

@carbon/ibm-products (previously @carbon/ibm-cloud-cognitive) version

v2.21.0

Severity

Severity 1 = The design is broken in a critical way that blocks users from completing tasks or damages the brand. Affects major functionality, no workaround.

Product/offering

SOAR

CodeSandbox or Stackblitz example

https://stackblitz.com/edit/github-peuqjs?file=src%2FDatagridCrash%2FDatagridCrash.jsx,src%2Futils%2Fhelpers.jsx

Steps to reproduce the issue (if applicable)

Steps to reproduce

  1. open stackblitz url
  2. click View table

Expected results
Datagrid table is rendered in screen without any errors

Actual results
Table is not rendered and there is error in console logs

Release date (if applicable)

No response

Code of Conduct

@marienellagallo marienellagallo changed the title Datagrid fails to render if added to virtual dom element Datagrid fails to render if added to virtual dom Jun 11, 2024
@elycheea elycheea added type: bug 🐛 Something isn't working component: Datagrid Sev 2 Aspects of design is broken and impedes users in a significant way, but has workaround. Sev 3 Visible or noticeable to users but does not impede functionality. Has a workaround. and removed status: needs triage 🕵️‍♀️ Sev 2 Aspects of design is broken and impedes users in a significant way, but has workaround. labels Jun 24, 2024
@matthewgallo
Copy link
Member

Hi @marienellagallo, just checking in. Is this still an issue for SOAR?

@amal-k-joy amal-k-joy self-assigned this Sep 13, 2024
@amal-k-joy
Copy link
Contributor

amal-k-joy commented Sep 13, 2024

Hi @marienellagallo ,
The document.createElement() method in JavaScript is used to create a new HTML element. When this method is called, it creates an instance of the specified element type, but it does not add it to the DOM until you explicitly append it.

Once you add document.body.appendChild(tableDomNode);, datagrid will render I think.
image

@marienellagallo
Copy link
Contributor Author

Hi @matthewgallo @amal-k-joy we've added fix for this

@ljcarot ljcarot closed this as completed Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Datagrid Sev 3 Visible or noticeable to users but does not impede functionality. Has a workaround. status: waiting for author 💬 type: bug 🐛 Something isn't working
Projects
Status: Done 🚀
Development

No branches or pull requests

5 participants