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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ic-data-table] - data table does not render when content slotted into table cell #1906

Closed
ad9242 opened this issue May 23, 2024 · 0 comments
Assignees
Labels
data-table component The generic component, includes both the web component and the React component type: bug 馃悰 Something isn't working
Milestone

Comments

@ad9242
Copy link
Contributor

ad9242 commented May 23, 2024

Summary of the bug

When adding a <SlottedSVG> to a table cell, the data-table does not render and an error appears in the console

馃獪 How to reproduce

With the following code in React storybook:

<Canvas withSource="none">
  <Story name="icons in data">
    <IcDataTable
      caption="Icons in data"
      columns={COLS_ELEMENTS}
      data={DATA_REACT_ELEMENTS}
    >
      {DATA_REACT_ELEMENTS.map((_, index) => (
          <SlottedSVG 
            key={index} 
            slot={`actions-${index}`} 
            height="24px"
            viewBox="0 0 24 24"
            width="24px" path={mdiAccountGroup}>
          </SlottedSVG>
      ))}
    </IcDataTable>
  </Story>
</Canvas>

  1. View the story
  2. See that no content appears
  3. in the browser developer tools, see there is a console error along the lines of:
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at ic-data-table.js:70:63
    at Array.map (<anonymous>)
    at DataTable.createCells (ic-data-table.js:66:30)
    at ic-data-table.js:164:25
    at Array.map (<anonymous>)
    at DataTable.createRows (ic-data-table.js:144:18)
    at DataTable.render (ic-data-table.js:362:194)
    at callRender (index.js:1515:39)
    at updateComponent (index.js:1467:5

馃 Expected behaviour

The data-table should appear with icons in the cells

馃摑 Acceptance Criteria

If relevant, describe in full detail the different interactions and edge cases that the component or patterns needs to fulfil.

Given a data table
When a <SlottedSVG> is placed in the {COLUMN_KEY}-{ROW_INDEX} slot
Then the data-table should be rendered and the icon(s) should be visible

Additional info

This only happens when using the {COLUMN_KEY}-{ROW_INDEX} slot.
It works correctly when using the {COLUMN_KEY}-{ROW_INDEX}-icon slot
It also work when placing an <svg> directly in th eslot rather than using the <SlottedSVG>

@ad9242 ad9242 added type: bug 馃悰 Something isn't working data-table component The generic component, includes both the web component and the React component labels May 23, 2024
@ad9242 ad9242 added this to the PI 7 V.2 milestone May 23, 2024
@ad9242 ad9242 self-assigned this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-table component The generic component, includes both the web component and the React component type: bug 馃悰 Something isn't working
Projects
Development

No branches or pull requests

2 participants