Up to here, every page of the Kladde is static: The server renders it once per request, sends HTML and forgets it. For almost everything, that’s right. A week calendar, though, is a case where it becomes annoying. Whoever at the office wants to see the appointments of the next three weeks clicks “Next week” three times, and three times the whole page reloads, with header, navigation and stylesheets.

In this lesson, the calendar becomes the Kladde’s first interactive island: a component that lives on after the first display and answers clicks without the page reloading. Everything around it stays static.

When interactivity pays off

Interactivity costs something (lesson 2.5.1): with Interactive Server, a permanent connection and memory on the server for every open page, with WebAssembly a download of several megabytes. And without script, an island doesn’t work at all. It pays off if at least one of these applies:

  • The page reacts to many small steps, and every step with a reload would be noticeably slow: paging, sorting, expanding.
  • The display changes without the person doing anything, for example because a colleague has just entered an appointment.
  • An input needs an immediate answer that only the server can give, before the form is submitted.

And it doesn’t pay off if a page with links and forms can do the same. So the public booking stays static: It’s used rarely, by many different people, on every device, and it has to work without script. The calendar, on the other hand, is internal, a few people use it often, and paging is exactly the case of “many small steps”.