-
Notifications
You must be signed in to change notification settings - Fork 648
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
Awaiting in onCreate doesn't work as expected #1722
Comments
Usually the |
I tried that, but then I have to put everything like scripts and what not underneath the await tag. I want (at least I think I want) the data available for the entire page, like way down in the script section. Unless I'm just thinking about this stuff all wrong... ? |
Ok, so that works if I move the script into the await block. But I can't use |
@treeder the async logic of your app is currently intended to be executed on the server side only with Marko. If you have some stateful logic what will work best is to move that lower in the component tree, such that the higher components (with async content) can be bundled and resolve only on the server. The lower we can move state in the tree, the fewer components that need to be shipped to the browser, so it typically ends up being a perf win also. |
I'm trying to fetch some data to put in the state before rendering, but I can't seem to make it work. I've tried the following:
I also tried:
So it seems that the state will not be set properly after an
await
inonCreate
. I feel like it should let onCreate complete fully before continuing so the state can be setup properly. Is that now how it's intended?The text was updated successfully, but these errors were encountered: