amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.58k stars 208 forks source link

Client reload doesn't work out-the-box in Chomium #1221

Open faustinoaq opened 4 years ago

faustinoaq commented 4 years ago

Description

Chromium Browser doesn't update the code changes in main.js or main.scss

Steps to Reproduce

  1. amber watch
  2. Open http://0.0.0.0:3000/ in Chromium Browser
  3. Change $primary in main.scss
  4. See triggered reload in Chromium Browser

Expected behavior: color changes

Actual behavior: colors doesn't change

Reproduces how often: 100%

Versions

$ shards --version
Shards 0.10.0 (2020-05-03)
$ crystal -v
Crystal 0.35.0 (2020-06-09)

LLVM: 10.0.0
Default target: x86_64-pc-linux-gnu
$ amber --version
Amber CLI (amberframework.org) - v0.35.0
$ npm -v
6.14.5
$ node -v
v14.3.0
$ lsb_release -a
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:        20.0.3
Codename:       Lysia

Additional Information

The issue goes away when I check the option Disable cache (when DevTools is open)

image

I opened this issue to confirm Is this the right workaround or should I change some cache settings in my app?

Happy Crystalling! :heart: :sunglasses:

eliasjpr commented 4 years ago

@faustinoaq do you think you can take a look at this?

midhun-at-vineti commented 4 years ago

Looks like this has to do with how Chromium and Chrome behave on 'Cache-Control' header, which is set by pipes/static.cr to private, max-age=3600.

I tried reproducing this in Chrome but Chrome for some reason doesn't cache the main.bundle.css file but Chromium caches it and is reproducible.

@eliasjpr @faustinoaq Do you think it would be a good idea to make the static response headers configurable? Would be happy to create a PR.

eliasjpr commented 4 years ago

@midhun-at-vineti Yes lets make those headers configurable if possible have some default for Chromium

midhun-at-vineti commented 4 years ago

@eliasjpr on it. 👍