addInlineJs only works once

I have a very strange problem.

Javascript code should be inserted inside the page. So i do:

{% set script %}
  ... some JS Code...
{% endset %}
{% do assets.addInlineJs(script,{ 'group':'bottom','priority':100 }) %}

{{ assets.js('bottom') }}

The first time I load the page everything works perfectly. But, if I click on F5 to reload the page, the JS code is no longer available.

But why???

Thank you very much!

Okay, I found out it’s related with the caching. If I turn off caching, it works.
But that can’t be the solution. :wink: