Skip to content

UI loading is delayed if custom palette is selected upon page load #5204

@DedeHai

Description

@DedeHai

What happened?

There is a circular dependency in index.js:
when the UI is loaded and the selected palette is a custom palette, the call to requestJson() throws an error because it calls readState() but the selected palette is not yet known because the palette list can only be filled including custom palettes after the lastinfo is fetched, which happens in requestJson(). So the UI throws this error:

To Reproduce Bug

select a custom palette, reload the UI

Expected Behavior

resolve custom palettes without throwing the error.

Install Method

Binary from WLED.me

What version of WLED?

nightly build

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

TypeError: Cannot read properties of null (reading 'querySelector')
    at updateSelectedPalette ((index):7:63528)
    at updateUI ((index):7:62253)
    at readState ((index):7:68130)
    at (index):7:71556

Anything else?

the UI still load correctly, it just takes longer due to timeouts and there is the error thrown.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions