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

[TwigComponent] Support HTTP render #707

Open
onEXHovia opened this issue Feb 25, 2023 · 5 comments
Open

[TwigComponent] Support HTTP render #707

onEXHovia opened this issue Feb 25, 2023 · 5 comments
Labels
docs Improvements or additions to documentation Stalled

Comments

@onEXHovia
Copy link
Contributor

TwigComponent is great as a replacement render(controller(...)). The page often consists of different blocks, and in order not to overload the controller, the page could be broken through render(controller (...)) but he causes performance issues CPU.

At the moment, the only difference is that the controller can be called on the URL. It is very common to need update a specific block after submitting form. What do you think about this?

@weaverryan
Copy link
Member

I also think that TwigComponents is a great replacement for render(controller()) when you're not intending to cache the result (e.g. render_esi) for the performance reasons you suggested.

This is already possible today. What piece are you missing? You mentioned:

At the moment, the only difference is that the controller can be called on the URL. It is very common to need update a specific block after submitting form

Can you give me more info about the use-case? If you transform a TwigComponent to a LiveComponent, then you CAN "access" that component via a URL - you can get that URL by using the (undocumented) component_url function. I'm not sure your use-case, but you can get the URL in twig via:

{{ component_url('my_component_name, { prop1: 'foo'}) }}

@weaverryan weaverryan added the docs Improvements or additions to documentation label Feb 27, 2023
@onEXHovia
Copy link
Contributor Author

I also think that TwigComponents is a great replacement for render(controller()) when you're not intending to cache the result (e.g. render_esi) for the performance reasons you suggested.

Yes, you are right, but for setting esi you need cloudflare or varnish. Varnish in the base version does not have parallel execution capability. Sometimes support looks like a lot of work 🙃

Can you give me more info about the use-case? If you transform a TwigComponent to a LiveComponent, then you CAN "access" that component via a URL - you can get that URL by using the (undocumented) component_url function. I'm not sure your use-case, but you can get the URL in twig via:

We do not use LiveComponent, since need a solution only for the backend without js. TwigComponent looks like a good analogue https://github.com/viewcomponent/view_component

Perhaps it makes sense to move this feature to TwigComponent from LiveComponent.

@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Friendly reminder that this issue exists. If I don't hear anything I'll close this.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation Stalled
Projects
None yet
Development

No branches or pull requests

3 participants