Open alexanderhupfer opened 6 months ago
Hey, thanks for raising this. We believe this is a consequence of how cloudflare tunnels (which the CLI uses by default for development) work. They seem to buffer the deferred response and return a single chunk, which seems to "break" the Suspense
component's expected behaviour.
We've added some documentation to the template to help work around this issue.
Please let us know if that solves it!
Hi thanks for looking into this - I'm aware of the cloudflare issue as stated at the bottom of my issue report. However the issues does also occur using ngrok but seems clearly related to the iFrame since it is working fine outside the iFrame.
Oh sorry, I failed to see you mentioned that. I'll start tracking this issue and we'll look into it.
FWIW I tried running your code and I saw the symptom you reported, but I also got a hydration error around the use of Suspense
. I haven't dug into it yet, but could that be related to the issue?
Hi, thank you for looking into this. As I mentioned in my report I did not observe the hydration error. The issue I linked mentioned the hydration error and related it to the then current react version as the error was resolved by upgrading to the now current react version.
@paulomarg Is there anything else you need from my side? I see the issue marked as "waiting for response"
Hey, sorry for the delayed response. I'll remove that label. I've added it to our backlog, so no other action needed now!
@paulomarg Is there any ETA on this? I'm having a couple of feature on the roadmap that rely on this
We have some other things that will take precedence here so I can't give any dates, but this is in our immediate list of items to investigate!
Hi, we've investigated this issue and it doesn't seem to be anything that the app itself is doing - I was able to reproduce your scenario with the code you provided (thanks!), and if I load that within an iframe outside of the Shopify admin, deferring works. That points to there being an issue in the admin itself and how it's loading the app.
I've forwarded this to the team that manages that part of the code, and they're going to look into it. However, this is probably not an easy fix, so it might take a while to resolve. In the meantime, I would suggest not using deferred requests in your app so it doesn't affect your performance metrics.
I'll keep you posted if I hear anything back from them! Thanks again for raising this issue.
@paulomarg Any feedback about this question?
Issue summary
Before opening this issue, I have:
@shopify
packagesv21.7.3
- Operating system: MacOS{ logger: { level: LogSeverity.Debug } }
in my configurationdefer
is not working inside the iFrame / embedded app. However it works outside the iFrame,Expected behavior
Page should render immediately, then the deferre content should appear once the promise has resoled.
Actual behavior
Page does not render until promise has resolved when inside iFrame
Steps to reproduce the problem
The browser log reports no hydration errors
Please not that there is a related issue to cloudflared due to which defer won't work with cloudflare tunnels: https://github.com/cloudflare/cloudflared/issues/1095
Hence I used ngrok for testing, for which defer works as expected, just not inside the admin iFrame.