Skip to content

themeOverrides with undefined values result in Error during render. #1180

Description

@atamon

Hello,

First of all thanks for developing this project. We use this in production to implement a minimal spreadsheet-like preview and it works great!

We recently bumped the dependency of @glideapps/glide-data-grid and @glideapps/glide-data-grid-source from 5.3.2 to 6.0.4-alpha24 and got this "crash":

color-parser.js:17 Uncaught TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at parseToRgba (color-parser.js:17:1)
    at blend (color-parser.js:67:1)
    at mergeAndRealizeTheme (styles.js:109:1)
    at data-grid-render.header.js:33:1
    at walkColumns (data-grid-render.walk.js:43:1)
    at drawGridHeaders (data-grid-render.header.js:22:1)
    at drawHeaderTexture (data-grid-render.js:147:1)
    at drawGrid (data-grid-render.js:231:1)
    at data-grid.js:393:1
    at data-grid.js:451:1

Which looks to end up at this line:

const normalizedColor = color.toLowerCase().trim();

Our offending code/repro defined a themeOverride like this on the GridColumn type:

  themeOverride: {
    bgCell: visualizeHidden ? 'lightgrey' : undefined,
    bgHeader: visualizeHidden ? 'lightgrey' : undefined,
  }

It's of course quite easy to get around this issue for us by filtering out undefined properties from the themeOverride. But I wanted to give you the chance to fix this if you consider it a bug in the new major.

Please close this issue if you believe this is the intended behavior going forwards.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions