Skip to content

addRandomColor makes infinite loop in some circumstances #7

@stanrocks

Description

@stanrocks

There is an issue with "addRandomColor" method inside NewPaletteForm.js.

Required conditions:

  1. User deleted all palettes but first one ("Material UI Colors"), which has only 19 colors or less;
  2. User is adding colors to new palette with "random color" button only.

This will lead to situation, when there is no any unique color left (we need at least 20 unique colors to fill whole palette using "random color" button), "isDuplicateColor" will be truthful forever, while loop will run infinitely.

To fix that we need to store somewhere at least 20 unique colors at any point of time, even when there will be less than 20 colors in user's palettes, so those colors would always be available for "addRandomColor" method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions