johannschopplich / kirby-vue3-starterkit

✨ Kirby + Vue SPA starter: automatic routing, i18n, SEO and more!
MIT License
206 stars 19 forks source link

`home.json` is fetched on every route #6

Closed johannschopplich closed 4 years ago

johannschopplich commented 4 years ago

✅ Anwered in the FAQ section of README.

johannschopplich commented 4 years ago

Update: Embedding the global site object inside home.json has been reconsidered after food for thought by @tchmnn. Thanks! His reasoning: even if home.json currently contains little data, the overhead in projects created on the basis of these starter kits can grow rapidly. Also the current behaviour doesn't follow SoC. Valid arguments.

Therefore the implementation has changed.

As of the latest commit, https://github.com/johannschopplich/kirby-vue3-starterkit/commit/2b3b277d7763174dfc7f7f99bba5fc05a4698175 the JSON-encoded site object is embedded in the HTML. Thus a critical request is saved. Beforehand, the app had to wait for the home.json to load (even if it was handled by a prefetch link) before being able to mount since the router has to be populated with routes provided by site. Now with site being delivered upon initial call, the router can initialize straightaway.