Comments (6)
I chatted about this with @smnandre. As he's done such a great job diving into this, I'm hoping he can get us a small PR (even a draft PR) to illustrate the changes he's imagining. It's tough to fully understand the problem for many of us without diving in super deep ourselves. And this is a very technical area :)
Related: due to this bug, the new defer
attribute does NOT work if you use a tag with content - e.g. <twig:heavy-thing defer />
works, but <twig:heavy-thing defer></twig:heavy-thing>
will render normally, not lazily.
from ux.
@StevenRenaux you did not register your component classes in services.yaml
Try with
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
Component\:
resource: '../components/'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
``à
from ux.
@arnolem , @smnandre I made a reproducer and for me the problem could come from the naming of the components in template DIR.
https://github.com/StevenRenaux/triage_issue_52154
When it's button.twig
it doesn't work but named button.html.twig
it work well or maybe I didn't understand something for reproducing right.
Work as well with component registered and Class named well from the last commit.
from ux.
My working "reproducer" .. do you see anything different of your install @arnolem ?
https://github.com/smnandre/twig-button
from ux.
I added a few elements to be as close as possible to my use case and I have the problem.
👉 smnandre/twig-button#1
from ux.
So, there is indeed a problem, or at least something not documented.
Currently, it's not possible to change dynamically the template of a embed
component (one with blocks inside).
It is possible today (in 2.12.0 and 2.x-dev), but only with the self-closing tags (similar to an include
in Twig)
So with your configuration
{# OK - renders components/Button/button.twig #}
<twig:button />
{# OK - renders components/PrimaryButton/primary-button.html.twig #}
<twig:primary-button />
{# NOT OK - tries to render component/button.html.twig #}
<twig:button></twig:button>
{# NOT OK - tries to render component/primary-button.html.twig #}
<twig:primary-button></twig:primary-button>
It is something we are working on, but i cannot assure you will be able to dynamically change the embed components templates in the near future.
So for now I see two "working" solutions:
- use the self-closing tags & your subscriber
- write the full template in your attributes
Maybe some others with more experience may have another idea ?
from ux.
Related Issues (20)
- [LiveComponent][Documentation] Unclear instructions for Javascript HOT 9
- [Autocomplete] Fetch results with elasticsearch HOT 3
- [UX Live] Wrong display value for loading element show HOT 5
- [Autocomplete] Module build failed @symfony/ux-autocomplete/package.json" could not be found HOT 3
- [LiveComponent] data-loading behaviour not working correctly in child components HOT 7
- [LiveComponent] addCollectionItem don't work when using DTO as source HOT 4
- [UX] 503 error with opcache JIT enabled HOT 5
- [TwigComponent] props reflexion HOT 7
- [TogglePassword] htmlspecialchars for button-classes HOT 4
- [TwigComponent][LiveComponent] Compatibility with Twig 2.9 / use_yield HOT 4
- Documentation could be improved by being clear about incompatibility with AssetMapper HOT 6
- [LiveComponent] Loading state on specific form fields, documentation incomplete HOT 1
- [LiveComponent] Form re-render only possible with live-id on component instantiation
- import { getComponent } @symfony/ux-live-component with AssetMapper not working HOT 4
- [Live Component] Datepicker bug at onchange HOT 5
- [Twig] avoid need for `{{ }}` around spread operator when using html-syntax HOT 4
- [Chart.js] Stimulus connect is called multiple time causing errors
- [Live Component] The User cannot be retrieved from a component extending AbstractController HOT 6
- [LiveComponent] Reinitializing Choices.js plugins HOT 5
- The file "@symfony/ux-chartjs/package.json" could not be found HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ux.