-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Preloaded URLs generator #154
Comments
I was playing with a bundle recently https://github.com/Pierstoval/SmokeTesting that creates test routes for pages that had no parameters (e.g. home, contact, etc.). This idea could be used to create a pre-load service as described above, that returns a list of all the routes with no parameters. The downside is that inspecting all the routes this way on every request isn't very efficient, so better might be to cache those routes during the compiler pass. I had some code in pwa-exta to do this, but I never got it working quite right. Regardless, that's an enhancement/optimization, if you implement this service it will make it much easier to add those preload urls, thanks! |
Can you name the interface UrlGeneratorInterface? I like the suffix, I think it's pretty standard. |
This will be donne soon. See #155 |
I am not sure it is correct to list all routes without parameters. Some of them are private and there is not reason to cache them. |
Makes sense. I have an attribute in PwaExtraBundle that I'll use when this is implemented to define the routes from attributes, rather than all routes without parameters, as you say. |
That's also the idea behind these services. You can return URLs from static values, a list of entries in a database and even routes with an attribute. |
Thanks! Are there any demo repos that show this? Maybe QOTD? I know you haven't started the 1.2 branch of the docs yet, maybe a working demo would be easier while 1.2 is still in dev. |
I've just updated the phpwa-demo repo. |
Instead of #[PreloadUrl(alias: 'homepage', params: ['_locale' => 'fr'])]
#[PreloadUrl(alias: 'homepage', params: ['_locale' => 'en'])]
#[PreloadUrl(alias: 'homepage', params: ['_locale' => 'it'])] What about implementing the UrlGeneratorInterface and using the service? That would also allow you get get the acceptable languages from the Symfony services. Coincidentally, I've been playing around with a bundle for storing translations in doctrine, since DoctrineExtensions, which I used to use, doesn't support Symfony 7. |
I was just testing if multiple attributes works fine. But yes you are right in this case a service would be better.
I used to play with it in the past. But found it was hard and stopped. |
polyglot-bundle looks pretty interesting, as soon as my PR that fixes webfactory/WebfactoryPolyglotBundle#52 is accepted I'll put it in a PWA. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
The preloaded URLs for resource caching is very simple: it is a list of URLs or route names with/without params.
It can be difficult or boring to list all possible values.
For example, let's imagine an application with 4 features. The application is served in 3 differents languages.
The configuraiton file will looks like as follows:
We could imagine a service that will generate the URLs for us. Each application will be free to manipulate that list depending on its needs.
Example
The text was updated successfully, but these errors were encountered: