question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FastBoot and waiting for additional asynchronous content

See original GitHub issue

Summary

There are times that you’d want ember to load data asynchronously in the browser. This changes when in FastBoot, you have a single pass before the response is sent back to the browser, and there is no updating the source once the response is sent when it comes to crawlers. Some content you may want index may be loading asynchronously in the Ember app, but needs to be there for crawlers

FastBootInfo.deferRendering(promise)

By adding a method to chain promises to the FastBoot service, we can allow the user to notify FastBoot which promises this page depends on before rendering. The server would then wait for this promise to resolve after hitting the visit method of the app, so that all the routes/components/etc could notify the server. This would be an explicit call to fastboot.deferRendering.

Additional consideration

Should this be done for all ember-data calls automatically in FastBoot-land. There is an argument in both directions. This would ensure that all ember-data calls are completed before rendering the page, which would cover the majority of use cases for the typical user. Instead of having to check to see if we are in FastBoot and then explicitly call deferRendering, we could hook into ember-data to do this automatically.

Instead of hooking into ember data, we could provide an additional hook to the route, akin to a fastBootModel which will be expected to return a promise that should block the rendering of the page until.

Drawbacks from ember-data and hooks approaches

Both the ember-data approach and fastBootModel hook approach would prevent the user from doing their own checks of whether or not they are in FastBoot and handle that case appropriately, but bring in addition work. And there may be cases in the ember-data approach that you would not want to wait for every ember-data operation to resolve before allowing FastBoot to return the response.

/cc @tomdale @ef4

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
markmhxcommented, Nov 2, 2017

@courthead Good question, and I think the short answer is Shoebox: https://github.com/ember-fastboot/ember-cli-fastboot#the-shoebox

After implementing deferredRendering with my components, I started experiencing the redrawing problem you describe with my site. I need to try implementing Shoebox to know for sure, but I think with a standard implementation, it should prevent the reloading of data and subsequent redrawing.

1reaction
markmhxcommented, Oct 9, 2017

In case anyone finds this thread through search and is looking for a similar solution, @kratiahuja pointed me toward the deferRendering method on the FastBoot service.

The following is an example of how to use it to accomplish the above (thanks @danmcclain!):

https://github.com/ember-fastboot/ember-cli-fastboot/blob/2e913eb907d3a8aa2b64d87b2877704a365fa6bf/test/fixtures/async-content/app/components/async-content.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

fastboot/README.md
The fastboot protocol is a mechanism for communicating with bootloaders over USB or ethernet. It is designed to be very straightforward to implement,...
Read more >
Shoebox - Ember FastBoot
FastBoot will wait for these promises to resolve, allowing the app to rerender itself based on new data coming in asynchronously before sending...
Read more >
"waiting for device" in Fastboot Mode... - XDA Forums
Now I am on the second release of Android 11 and when I try to flash modified boot image in fastboot mode it...
Read more >
Understand the Effect of Fast Logon Optimization and Fast ...
Asynchronous processing affects Group Policy in the following ways: At startup The client computer does not wait for the network to be fully ......
Read more >
[Fix] Fastboot Mode Waiting for Device - YouTube
This video will show you how to Fix Fastboot " Waiting for Device " erro on OnePlus One.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found