Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset assets on FINISH_REQUEST. #115

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Conversation

Warxcell
Copy link
Contributor

Fixes #90, #94

@Warxcell Warxcell changed the title Reset caches on FINISH_REQUEST. Reset assets on FINISH_REQUEST. Mar 19, 2021
@weaverryan
Copy link
Member

Sorry for the slow merge - thank you @Warxcell!

@weaverryan weaverryan merged commit 7142b68 into symfony:main Feb 10, 2022
weaverryan added a commit that referenced this pull request Feb 14, 2022
This PR was squashed before being merged into the main branch.

Discussion
----------

Fixing routing config in tests

I think some wires we previously crossed in the routing config, but it didn't really matter until #115. This fixes things up.

Commits
-------

5b4d2a6 Fixing routing config in tests
@blankse
Copy link

blankse commented Feb 15, 2022

@weaverryan After upgrading to v1.14.0 I have following error:
I have 2 entrypoints in my webpage. One on the top and one on the bottom. In v1.13.2 the runtime.js from webpack is only loaded in the entrypoint on the top. Now it is also loaded at the bottom and scripts are executed twice which makes makes mistackes (double click events...)

What can I do to have the runtime.js only on top?

@Warxcell
Copy link
Contributor Author

Warxcell commented Feb 15, 2022

Hm, do you have sub-requests in-between? Can you provide reproducible code in some repo so I can fork and add a fix? Or directly add test case ?

@blankse
Copy link

blankse commented Feb 16, 2022

@Warxcell Yes there are sub-requests in-between. I can try to give you an reproducible code example.

@noahduncan
Copy link

We're seeing similar issues with duplicate runtime.js script tags for our code. I see use cases both ways, sometimes you want your all script tags on every request, sometimes you don't. To me, that makes it feel like the option should be configurable somewhere.

@scrummer
Copy link

scrummer commented Mar 21, 2022

@Warxcell @weaverryan We also ran into the problem, that one of our projects kept loading the runtime.js multiple times. In our case it lead to forms being sent multiple times (including submission emails). Really had to look deep to figure out why it did that.
However; I kind of get the point why you guys implemented that feature. For us, this problem occured in the Pimcore ecosystem which uses (depending on the use-case) some up to a lot sub-requests.

As already stated; from a developers perspective I totally understand why you implemented that, but I think this sub-request thingy could break a lot of stuff. We were happy that it was "just" a contact form. I was wondering what would've happened if we updated the bundle in one of our larger shop systems (multiple orders? multiple items in the cart by accident? etc etc).

Unfortunately I can't really think of a "better" alternative than the Request-Finished event. But I think it really makes sense to think about it, how it could impact users.

Thank you, stay healthy!

BR,
Jan

@H4wKs
Copy link

H4wKs commented Mar 26, 2022

@Warxcell as @zing-james explained in #166, if you use the twig render function you end up with runtime.js being load twice, this is a huge side effect as I believe many people (including myself) use this in their projects.

@kuldippujara
Copy link

Hi @Warxcell, @weaverryan,

I am having the same issue with embed controller after the update. I have check the other use cases where users want to reset the assets. I want to provide a suggestion that if we can differentiate the sub requests then we can put the condition when we want to reset and when we don't want to.

1 option is to add attribute in request similar to _format eg. _renderer : inline / fragment
which will be only available if its render by Fragment renderer.
then we can fix both the scenarios.

waiting for feedback.

Happy to create PR for Symfony and add attribute and then create PR to fix the issue.

@Warxcell
Copy link
Contributor Author

1 option is to add attribute in request similar to _format eg. _renderer : inline / fragment which will be only available if its render by Fragment renderer. then we can fix both the scenarios.

Sounds ok to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to "reset" cache of rendered files automatically in Twig
7 participants