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

Disable cache warmup when translator is identity translator #1965

Conversation

SanderVerkuil
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
Issues Fix #1962
License MIT

If the present translator does not implement the TranslatorBag interface, which is the case if the framework bundle is enabled and either the form, or the validator are enabled, removes the warmup phase.

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Jul 5, 2024
@SanderVerkuil SanderVerkuil changed the title Fix/1962/disable cache warmup when translator is identity translator Disable cache warmup when translator is identity translator Jul 5, 2024
@smnandre
Copy link
Member

smnandre commented Jul 6, 2024

Thank you @SanderVerkuil !

Could you maybe add a line or two in the documentation ?

@smnandre
Copy link
Member

smnandre commented Jul 6, 2024

@maelanleborgne @Kocal if you can just confirm, as you know more than me this package :) ?

@SanderVerkuil
Copy link
Contributor Author

Thank you @SanderVerkuil !

Could you maybe add a line or two in the documentation ?

Done! Added a small note next to the cache warmup, feel free to modify it as you see fit, or if it's unclear I'd be happy to hear!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 6, 2024
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just waiting for a final confirmation from @Kocal.

Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, thanks for your contribution :)

@kbond kbond force-pushed the fix/1962/disable-cache-warmup-when-translator-is-identity-translator branch from cef9ca6 to b75e5d5 Compare July 8, 2024 15:38
@kbond
Copy link
Member

kbond commented Jul 8, 2024

This is great, thanks Sander!

@kbond kbond merged commit 280e95d into symfony:2.x Jul 8, 2024
14 checks passed
Kocal added a commit to Kocal/symfony-ux that referenced this pull request Aug 13, 2024
Kocal added a commit to Kocal/symfony-ux that referenced this pull request Aug 13, 2024
@@ -71,6 +71,10 @@ For a better developer experience, TypeScript types definitions are also generat
Then, you will be able to import those JavaScript translations in your assets.
Don't worry about your final bundle size, only the translations you use will be included in your final bundle, thanks to the `tree shaking <https://webpack.js.org/guides/tree-shaking/>`_.

.. note::

This package requires the `translator` to be enabled in your Symfony application. If you don't use the `translator` service, the warmup command will not generate any translations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package requires the translator to be enabled

Is translator a package, a service of something else? In the next sentence it is written that it's a service, I think it should be explicit in the first sentence too.

Copy link
Contributor

@alexislefebvre alexislefebvre Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code should have double quotes, otherwise it is displayed like this:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this note in #2061

@SanderVerkuil SanderVerkuil deleted the fix/1962/disable-cache-warmup-when-translator-is-identity-translator branch August 13, 2024 22:53
Kocal added a commit to Kocal/symfony-ux that referenced this pull request Aug 14, 2024
Kocal added a commit to Kocal/symfony-ux that referenced this pull request Aug 14, 2024
kbond added a commit that referenced this pull request Aug 14, 2024
…fony applications (Kocal)

This PR was merged into the 2.x branch.

Discussion
----------

[Translator] Revert #1965, which break cache warmup for Symfony applications

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #2056 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Hi everyone!

It looks like we were too fast on #1965, and our tests base didn't see the issue.

With 2.19.0, people started to have issues with the CacheWarmer from UX Translator, which was... simply never called, and so the folder `var/translations` was not generated anymore.

In private, we've decided to revert the feature to fix the issue, and to re-open the discussion if necessary.

Commits
-------

baf9f5e [Translator] Revert #1965, which break cache warmup for Symfony applications
kbond added a commit that referenced this pull request Aug 14, 2024
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

[CI] Test ux.symfony.com with local UX packages

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Following #1965 and #2060, I was a bit surprised to see ux.symfony.com tests were executed with UX packages coming from `2.x` branch, instead of UX packages from the same PR.

I believe doing this could help us for the future and prevent some regressions.

I've updated the script `.github/build-packages.php` to automatically replaces **all UX packages requires(-dev)** from all significant `composer.json` files from the repo:
<img width="1270" alt="image" src="https://github.com/user-attachments/assets/e04ff73f-7558-46cc-91e2-bf49c26a7f04">

Commits
-------

1386749 [CI] Test ux.symfony.com with local UX packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Translator] Warming up the cache fails when the translator is disabled.
6 participants