JS assets don't get included if global cache is on

I’m seeing confusing behavior that I’m trying to figure out. Here is the rough scenario:

  • I have a modular page template that adds a JS asset:
    {% do assets.addJs('theme://js/bar.js') %}
  • Initially, everything worked fine, the page with the modular page did load the JS
  • Suddenly, the Javascript file is not being included in the page anymore
  • Toggling the js_pipeline option from true to false (or vice versa) will temporarily fix this, but shortly after the file will not be included again

What could possibly be the cause for this behavior?
Grav is at the most recent version, 1.6.23.

Update: It seems like turning off the global Cache option prevents this issue from happening. This explains why I never ran into the problem during development and only now that I’ve deployed the page. I will use this is a workaround for now, but it obviously isn’t a fix/answer.

Thanks for the update. Do consider reporting this as an issue in the Grav’s Github repo if you still think it is one.

[Edit: marked this response as solution since Discourse doesn’t seem to have another way to mark this question resolved]

Thanks hughbris. I decided to unmark your reply as ‘solution’ for now, as I’m not yet sure whether what I’m seeing is an actual Grav bug or simply a config/template issue on my part. It seems like other people should’ve already run into this issue before if it was a bug. Hence, I’d like to potentially get some more input on that before reporting a bug.

If there is no input coming in over the next days, we can mark your reply as solution again. I hope you’re okay with that?

No problem. Now that you’ve added more replies, probably use one of yours as solution instead when you’re ready :slight_smile: