etn-ccis/blui-react-component-library

Dev doc `"undefined"` background image selection got interpreted as a string

Closed this issue · 5 comments

Describe the bug / expected behavior

For components with a backgroundImage prop, such as the Drawer Header and App Bar, whenever the backgroundImage prop is set to "undefined" in the playground dropdown selection, the console flashes a 404 warning because it cannot locate an image called "undefined".

What are the steps to reproduce?

  1. Go to Dev Doc drawer header or Dev Doc Appbar
  2. Open the console

Screenshot

image

Suggested fix

Likely a wrong interpretation on the dev doc side to retrieve a non-existent image located at "https://brightlayer-ui-components.github.io/react-dev/undefined"

We might need to change this switch statement so that when the background image is a string literal "undefined", we actually pass undefined to our components

export const getImage = (image: string): string => {
switch (image) {
case 'Pattern':
return topologyBgImage;
case 'Farm':
return farmBgImage;
case 'undefined':
return 'undefined';
default:
return 'undefined';
}
};

Anything else to add?

The icons dropdown selection seems to be working fine. This issue only exists for the background image selection.

@huayunh I'm unable to reproduce this issue today.

I am still seeing it after emptying my cache

image

Odd I have no issues on chrome or firefox. (locally that is, haha. I see its on the deployed site)

undefined-image.mov

This is haunting me