I’m defining a new StateField which needs to hit an API endpoint to download some data to operate on. Right now it looks like StateField’s lifecycle methods are all synchronous, so I’m performing this fetch in the root of the application and passing that data to a StateField singleton function, which returns the StateField instance.
If possible, I would love to colocate this fetch with the StateField itself, so that I can move this logic out of the application root and package it alongside the field. Is there a recommended pattern for performing async work in StateField’s create handler?