Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

DM-34030: Implement auto-refreshing notebooks #3

Merged
merged 6 commits into from
Mar 31, 2022
Merged

Conversation

jonathansick
Copy link
Member

While a notebook is being run by noteburst via the Times Square API, is is unavailable to the UI. We want to be able to refresh that iframe periodically in this initial period to eventually load the final HTML document.

To enable this the Times Square API provides a new /htmlstatus endpoint that provides metadata about the HTML render needed to support auto-refreshing the content: a flag of whether the HTML is available or not, and a digest of the HTML to indicate whether the client has the same version of the HTML as is on the server (i.e. to support notebooks with TTL settings). If the notebook is not available yet, this is set to a default value. Since swr revalidates data (every 1 second right now) the default key will be replaced with the digest. Changing this key on the iframe causes the iframe to reload.

@jonathansick
Copy link
Member Author

Related API PR: lsst-sqre/times-square#24

Times Square API provides a new /htmlstatus endpoint that provides
metadata about the HTML render needed to support auto-refreshing the
content: a flag of whether the HTML is available or not, and a digest of
the HTML to indicate whether the client has the same version of the HTML
as is on the server (i.e. to support notebooks with TTL settings). If
the notebook is not available yet, this is set to a default value. Since
swr revalidates data (every 1 second right now) the default key will be
replaced with the digest. Changing this key on the iframe causes the
iframe to reload.

Note that useHtmlStatus is refactored into a reusable hook; other
components can also use html status and share the same connection pool
(so no additional requests are being made).
@jonathansick jonathansick marked this pull request as ready for review March 31, 2022 23:43
The primer is based on the one written for Squareone.
@jonathansick jonathansick merged commit 1f01762 into main Mar 31, 2022
@jonathansick jonathansick deleted the tickets/DM-34030 branch March 31, 2022 23:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant