I noticed when using Phoenix.Sync locally that the browser wasn't caching requests as I hoped. After digging into the code I discovered that I need to configure send_cache_headers?: true. This worked nicely, but it would be helpful to document this (along with trade-offs and why I might not want to do this).
|
defp env_defaults(opts, :dev) do |
|
# can't use new tmp dir for every run in dev because the storage |
|
# path must remain consistent between invocations of children(), plug_opts() |
|
# and client()... |
|
# if we want to use emphemeral dir for dev storage then we have to persist |
|
# the storage_dir into the application config. |
|
opts |
|
|> Keyword.put_new(:send_cache_headers?, false) |
|
end |
I noticed when using Phoenix.Sync locally that the browser wasn't caching requests as I hoped. After digging into the code I discovered that I need to configure
send_cache_headers?: true. This worked nicely, but it would be helpful to document this (along with trade-offs and why I might not want to do this).phoenix_sync/lib/phoenix/sync/electric.ex
Lines 386 to 394 in 405710e