Closed nesk closed 4 years ago
the right solution instead would be to add a cache resource invalidating the cache when changing the exposed routes too.
@stof Couldn't agree more, but until someone is willing to do this (seems to require a bit of work) maybe we could merge this to solve the current issue?
Thanks @nesk, I see no harm in ignoring the cache in debug mode so I've merged this.
Further to my bug report in #389, looking at the code, ConfigCache should already be working correctly. @nesk did you look in the var/cache/dev/fosJsRouting/data.json.meta
file to check if it was seeing config/packages/fos_js_routing.yaml
file as a Resource? For example, I can see /srv/www/config/routes/0-fos_js_routing.yaml
is listed in my meta file, which correctly reflects our routing files.
I'm having a hard time with this package in local environments, I've included the JS script like this:
However, whenever I add, change or remove a route in
config/packages/fos_js_routing.yaml
, I must runrm -rf var/cache/*/fosJsRouting
(bin/console cache:clear
doesn't work) to see the applied changes in the response offos_js_routing_js
.It seems like
ConfigCache
is the culprit, so I've made a simple change to bypass the cache when the debug mode is enabled.