| 1 | import "./styles.css"; |
| 2 | |
| 3 | import { Runtime } from "foldkit"; |
| 4 | |
| 5 | import { Flags, init, Message, Model, update, view } from "./main.ts"; |
| 6 | |
| 7 | const application = Runtime.makeApplication({ |
| 8 | Model, |
| 9 | Flags, |
| 10 | init, |
| 11 | update, |
| 12 | view, |
| 13 | container: document.getElementById("root"), |
| 14 | }); |
| 15 | |
| 16 | // HYDRATE, not run: the document arrives already rendered, so the client |
| 17 | // adopts that DOM instead of rebuilding it. The Flags the server used are |
| 18 | // read back out of the page — `hydrate` takes no Flags producer of its own. |
| 19 | // The build id is what makes adoption safe: hydration compares it against the |
| 20 | // one the server stamped and refuses a page from another deployment. |
| 21 | Runtime.hydrate(application, { buildId: import.meta.env.FOLDKIT_BUILD_ID }); |