andrewfiorillo / sketch-palettes

A Sketch plugin for exporting and importing fill presets. It supports colors, gradients, and pattern fills.
MIT License
2.27k stars 134 forks source link

Crash when clearing color palette #40

Closed bomberstudios closed 7 years ago

bomberstudios commented 7 years ago

Steps

  1. Install the latest Sketch Palettes version
  2. Create a new document, draw a Rectangle
  3. download and unzip this file: crash.sketchpalette.zip
  4. Menu › Plugins › Sketch Palettes › Global Palettes › Load Palette... › find and load the palette file from previous point
  5. select the Rectangle and open its Fill Color popover
  6. expand the Global Colors (if it's not expanded already)
  7. Menu › Plugins › Sketch Palettes › Global Palettes › Clear Palette
  8. Collapse the Global Colors and expand them again = crash
andrewfiorillo commented 7 years ago

Ok, I can reproduce. It happens any time you clear global colors (if you have any) while the color picker is open, and then collapse and expand the global colors section with the color picker still open.

Nothing in the console when it crashes. Any ideas?

Also, and potentially related: one thing I haven't been able to figure out is how to refresh the color picker UI while it is open, to show the new colors that were loaded. they only show up if you close and reopen the color picker (which makes sense, of course, since I'm only updating the data stored, not interacting with the UI). Do you know if that is possible?

alandickinson commented 7 years ago

One possible fix may be to clear any selections before loading a palette file. That would close the color picker, but may also prevent the crash.

If there's no way to refresh the color picker while it's open, it actually may be a better ux to close it before loading, so it isn't left open in an outdated state.

andrewfiorillo commented 7 years ago

Great suggestion. Better yet, would be just closing the color picker, since you might still want your selection. I just haven't been able to figure out how to dismiss the color picker yet (or any other UI changes there for that matter). But avoiding an even infrequent crash is probably worth losing your selection, until we can implement something else.

alandickinson commented 7 years ago

I just poked around, and I don't see a way to only close the picker either 😞. No action is fired when I manually open and close it, so it doesn't seem like its accessible via an API.

andrewfiorillo commented 7 years ago

@bomberstudios any chance you could point us in the right direction here?

andrewfiorillo commented 7 years ago

This crash appears to have been fixed in the latest release. Closing the ticket.