-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronous Block for VM.requires #135
Comments
The only option is to return Maybe we should add build-in |
After building UI libraries using VM.require. This is a must. My code gets very long because of all the null checks. |
Thinking about this more - it may be an anti-pattern to have a React component block rendering to wait on data. Usually, the pattern is:
Since After some lengthy debugging this evening, I have that working locally, but wanted to get thoughts. |
Would be nice to have the ability to set a custom fallback. |
That would be cool. The only issue there is that, whatever the custom fallback component is, it would have to be repeated in each file. If you were following DRY and broke out the fallback component into a single file, you'd have the original issue when trying to async load a loading component. Maybe the VM could provide a few options that live in the VM and aren't async loaded? |
Whenever I use VM.require, I need to do it with a null check:
This is because VM.require is essentially a Social.get, and so data may be null on the first requests.
This is different than a Widget, which returns a Loading widget as data fetches.
I'm wondering if we could create a synchronous block that must complete before the rest continues; almost like getServerSideProps for Next.js. Or is there a better practice?
The text was updated successfully, but these errors were encountered: