bartblast / hologram

Full stack isomorphic Elixir web framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After Hologram.Runtime.Watcher runs Mix.Tasks.Compile.Hologram ...

gregjohnsonsaltaire opened this issue · comments

After Hologram.Runtime.Watcher runs Mix.Tasks.Compile.Hologram, is there a recommended method of refreshing PageDigestStore et al other than by restarting phx.server (or :hologram app)?

Hey @gregjohnsonsaltaire, good news - the code reload should work correctly now. You just need to update the :hologram config to specify the endpoint used, such as it is done in the E2E app (test/e2e/config/config.exs):

config :hologram,
  ...,
  endpoint: HologramE2EWeb.Endpoint

Note that it won't be very efficient for big projects yet, because the whole thing is recompiled each time. But I plan to introduce incremental compilation in the near future.

Thanks @gregjohnsonsaltaire! :)

Yeah I will definitely add some example app and best practices section once I release v0.2.0 with the website.

Generally, server initiated components are for situations in which you want to decouple them from the containing page (e.g. when you don't want to pass the data loaded from DB in the props). Since they have additional conn param in their init function they will have access to session as well and some other context data related to connection. Their init function init(props, conn) won't be transpiled to JS. If you want the component to be initiable on both server and client you will just use define init(props) most of the time (which will be transpiled to JS). Hologram will detect this automatically depending on whether init/1 or init/2 is defined in the component.

As for the donations I haven't looked at it yet, maybe you have some suggestions? GitHub Sponsors?