-
Notifications
You must be signed in to change notification settings - Fork 650
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
BUG: await tag errors on rerender #675
Comments
This is happening in 4.3.1 as well with callback and promises in the await tag. |
This bug is still occurring in version 4.4.21, August 7th. In case it helps, here is a log printout of the error in-browser:
|
Here is my response on Gitter:
|
@patrick-steele-idem any idea when I have some components that use isomprphic fetch and want to use await on the server to render server side when the data is available, then on the browser it only re-renders when inputs change (which may trigger another fetch) I can't seem to get a workaround working I tried a component like this : ServerAwait.marko
and it gets me pretty close.. it ends up with a flash of no content when the client re-renders until the client has fetched the data again. One workaround could be to add a new argument to the await tag that takes a function returning a promise. If the await tag could retain the rendered dom until this new promise is resolved, it would then re-render nicely. |
What's the status? There are problems with communication. In #942 it was a high priority, now it just ignored. This issue contradicts the whole argument of "isomorphic code" for markojs. |
@StarpTech the tricky piece here is making it so that if you have a promise that is only rendered server side that it is serialized to the browser so that a hydrate can take place as normal. Our current thinking (although we have not had time to look at this holistically) would be to add promise serialization to warp10 which is what Marko uses internally to send the initial input to the browser for the first render. We have quite a few things on the go and this keeps getting pushed to the back burner but it is something that is a must have before or shortly after the release of Marko 5. I will add that @patrick-steele-idem's solution is still a viable work around here. |
@DylanPiercey thank you for the fast response. Currently, I run into this because I have no clue why my component was marked as "client" side code. #1285 (comment) |
Hi all. Is there an update on this issue now that Marko 5 is out? |
@jetrii no update as of yet. It is one of the things we want to get right in Marko 6. For now the recommendation is still the same, if you need the await client side it's best to use There is also my fairly hacky work around (https://gist.github.com/DylanPiercey/9d65759ffa4ff7752a2bc8aa74f5da40). For the most part it works, but doesn't support |
Bug Report
Context
If you have an await tag in a template that only gets rendered by an action, like setting state after the initial render, the await tag will error. The "$__sync" property is set to true by the updateManager.$__batchUpdate().
You get the following error
Uncaught Error: Not allowed
.Expected Behavior
It should run the await tag and wait for the promise to be fulfilled.
Actual Behavior
Throws an uncaught error.
Simple Example
This is a very simple example
Additional Info
Your Environment
Stack Trace
AsyncVDOMBuilder.js:171 Uncaught Error: Not allowed
at r.beginAsync (AsyncVDOMBuilder.js:171)
at t.exports (await-tag.js:231)
at r (index.html:33)
at renderer.js:195
at Component.js:525
at Object.s [as $__batchUpdate] (update-manager.js:63)
at n.$__rerender (Component.js:520)
at n.update (Component.js:470)
at o (update-manager.js:44)
at i (update-manager.js:16)
The text was updated successfully, but these errors were encountered: