How to re-render UI Kit component with polling/callbacks?

I’m trying to re-render my component when data changes in the future. The initial render will be <1s, but as data loads in the background, which could take up to 60-90s, the component should re-render to show a button allowing the user to load newly available data.

But I’m having lots of trouble with this:

  • Using setTimeout inside useEffect has no effect, it never gets called, even when done <1-3s
  • Initial state for useState can be a promise, and shows a built-in spinner, but when >25s, the app shows an error as expected
  • Using then callback on the promise of getJob().getStats() doesn’t ever get called, even when done <1-3s

Is it possible then to re-render a component with either polling (via settimeout) or callbacks (via promises)? If not, is there another way I’m missing? Thanks.

Hey @Steven
I believe that the answer to your question is Custom UI. I also like UI Kit but it’s designed to be simple and “static” (no re-renders etc) unless there’s UI interaction. So if I were you I would start looking into Custom UI.

1 Like

Thanks @Dmitrii, that makes sense.