The source of icons and search can be a promise which resolves to a valid JSON. We can accept that to have support for async source.
Display a loading status on placeholder and dropdown while waiting for the promise to resolve.
Once done, set the icons and search.
Children components should be able to pick it up.
This also means some changes in the structure:
Instead of relying on icons and search as props, we need to set state within FontIconPicker component.
If it is not a promise, then simply init. Set internal state sourceStatus to "done".
If it is a promise, then set state sourceInit to "waiting" and resolve the promise. When resolved, set sourceInit to "done". On error set sourceStatus to "error".
Child component will pick it up from the state and will show appropriate message and UI.
The source of icons and search can be a promise which resolves to a valid JSON. We can accept that to have support for async source.
This also means some changes in the structure:
FontIconPicker
component.sourceStatus
to"done"
.sourceInit
to"waiting"
and resolve the promise. When resolved, setsourceInit
to"done"
. On error setsourceStatus
to "error".API blob