Closed ledermann closed 4 years ago
thanks for finding this @ledermann ... the configuration in general is not super great. as you alluded to, mixing initializer configuration with runtime configuration is probably just not the right strategy. #37 is related to this.
@BrandonShar i think we need to take a step back and reconsider how we specify configuration, but in the meantime, let's merge the PR to address this and cut a new version... sound good to you?
it also happens for layout. we have a different value for inertia layout config.
38 introduced a serious bug within
InertiaRails.version
: It returnsnil
for every server response, so asset versioning is broken, which means the frontend will not be notified if the assets have changed.Why? To me it seems to be caused by the thread-safe change. Now there is
threadsafe_version
, so changing the version in one thread is not shared with other threads. This seems to be intended, because there is an explicit test for this.IMHO the thread handling is not correct. Typically, the version is set just one time within an initializer. Using a multi threaded application server like Puma spawns some new threads. So far as I know, spawning a new thread does not run the initializers again, so the
Thread.current
does not include thethread_safe_version
for all running threads.Try this is out in a Rails application using inertia_rails v1.4.0:
IMHO, the
layout
config has the same issue, but because it has a fallback, it will never benil
.