Loading content later
When parts of your page become slow, e.g, a metrics table that is expensive to render:
A common approach is to load content in async fashion by building out another set of routes, controllers, tests, with more work on the frontend to manage state, call fetch, etc.
With Breezy, we can turn content async with a single setting.
With defer: :auto
, PropsTemplate will render order.json.props
as usual, but without json.metrics
, then when the content is received by the client, Breezy will automatically make an remote
request for anything that was skipped:
It is up to you to handle the case when metrics
starts out empty. For example:
Alternatively, you can use a placeholder like so:
Last updated
Was this helpful?