thomas-lowry / figma-plugin-ds

A small lightweight design system for use in Figma Plugins
MIT License
693 stars 71 forks source link

Select menu broken, if there are no options #17

Closed gossi closed 4 years ago

gossi commented 4 years ago

Hey,

fantastic job on this UI toolkit for figma plugins. I just used it and I figured there is a bug with the select-menu. It fails and breaks everything after, if there are no options.

Bildschirmfoto 2019-12-30 um 18 57 10

Here is a screenshot I took from current development.

Looks like this is the affected line:

https://github.com/thomas-lowry/figma-plugin-ds/blob/f58d127fae0f0e566ca834b3e48bbbb5e1939dc9/js/selectMenu.js#L131

as this is the only .selected occurence ;)

My workaround is, that I only add the class class="select-menu" if I know I have options to that select and run the init after.

gossi commented 4 years ago

The workaround didn't work quite as expected. So I got another NPE. Here is the trace:

Bildschirmfoto 2019-12-31 um 14 00 45

That is given to how the DOM looks like now, I guess this line:

https://github.com/thomas-lowry/figma-plugin-ds/blob/f58d127fae0f0e566ca834b3e48bbbb5e1939dc9/js/selectMenu.js#L373

I'm also perhaps using this component in the wrong way. I meanwhile put my own code on GH, find it here: https://github.com/gossi/figma-style-references/

I will comment out the lines that invoke the selectMenu (so you can search for it in ui/ui.ts)

thomas-lowry commented 4 years ago

Thanks for flagging this and for your patience while addressing this. Addressed in an update of this that I am releasing.

https://github.com/thomas-lowry/figma-plugin-ds/pull/25

thomas-lowry commented 4 years ago

Fixed in the latest release which is now available as an npm package.