Title: [BootstrapAdminUi] Add custom stimulus controller · Issue #200 · Sylius/Stack · GitHub
Open Graph Title: [BootstrapAdminUi] Add custom stimulus controller · Issue #200 · Sylius/Stack
X Title: [BootstrapAdminUi] Add custom stimulus controller · Issue #200 · Sylius/Stack
Description: Description When using the BootstrapAdminUi bundle out of the box, it is a nice DX to not have to install and configure Symfony Stimulus Bundle and care that it exists at all. At some point, when needed to add custom Stimulus controllers...
Open Graph Description: Description When using the BootstrapAdminUi bundle out of the box, it is a nice DX to not have to install and configure Symfony Stimulus Bundle and care that it exists at all. At some point, when n...
X Description: Description When using the BootstrapAdminUi bundle out of the box, it is a nice DX to not have to install and configure Symfony Stimulus Bundle and care that it exists at all. At some point, when n...
Opengraph URL: https://github.com/Sylius/Stack/issues/200
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BootstrapAdminUi] Add custom stimulus controller","articleBody":"### Description\r\n\r\nWhen using the BootstrapAdminUi bundle out of the box, it is a nice DX to not have to install and configure [Symfony Stimulus Bundle](https://symfony.com/bundles/StimulusBundle/current/index.html) and care that it exists at all.\r\n\r\nAt some point, when needed to add custom Stimulus controllers, we tried with what it seems a \"standard Symfony way\" by adding [Symfony Stimulus Bundle](https://symfony.com/bundles/StimulusBundle/current/index.html).\r\nFor completeness, we chose [AssetMapper](https://symfony.com/doc/current/frontend/asset_mapper.html) to handle assets.\r\n\r\nConsequences are there are two started Stimulus apps: [one by BootstrapAdminUi ](https://github.com/Sylius/Stack/blob/8fcb13f517662e7aa0cb24453dcd2e721a4af0eb/src/BootstrapAdminUi/assets/app.js) and the other is the custom one with Stimulus Bundle.\r\nSo all requests made by [live components](https://symfony.com/bundles/ux-live-component/current/index.html) are made twice.\r\n\r\n### Additional context\r\n\r\nBy overriding the template of the `sylius_admin.base#javascripts` hook, we may avoid the load of the asset `bundles/syliusbootstrapadminui/app.js`.\r\nIt avoids the start of the Stimulus app by BootstrapAdminUi but other features like the ones provided by https://github.com/Sylius/Stack/tree/8fcb13f517662e7aa0cb24453dcd2e721a4af0eb/src/BootstrapAdminUi/assets/scripts are broken.\r\n\r\n### How to reproduce\r\n\r\n* Follow https://stack.sylius.com/getting-started.\r\n* Install [Symfony Stimulus Bundle](https://symfony.com/bundles/StimulusBundle/current/index.html)\r\n* Go on an admin page where there is a live component.\r\n* Trigger an action (either live action or update a model or emit an event etc..)\r\n* Check the number of AJAX requests with the [profiler](https://symfony.com/doc/current/profiler.html)\r\n\r\n### Possible solutions\r\n\r\nBefore proposing a patch, I'd like to have feedback on how to address this.\r\nMaybe I missed something somewhere 🤔 \r\n\r\n* BootstrapAdminUi may stop starting a Stimulus app.\r\nIt will imply that users will have to do it themselves like with Stimulus Bundle.\r\nIt seems fairly simple for a user to do it. In another hand it increases the number of dependencies a user have to handle.\r\n\r\n* BootstrapAdminUi may propose a way to allow users to chose if it should start a Stimulus app or not.\r\nIt may increase the complexity of maintenance of BootstrapAdminUi.\r\nIt will keep the nice DX allowing people to not care about the Stimulus part if they don't need to.\r\n\r\n* BootstrapAdminUi may propose to reuse it's started Stimulus app in order to register custom controllers with it.\r\nUsers won't be able to use the default behavior of the Stimulus Bundle which register the controllers automagically.\r\nOthers \"admin UI theme\" may chose to do the same to ease life of users.","author":{"url":"https://github.com/brambaud","@type":"Person","name":"brambaud"},"datePublished":"2024-12-31T10:56:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/200/Stack/issues/200"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6aacd8a3-471b-5f4e-9aa4-5ea2e70fd777 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCC8:ABFE0:B9CFA8:FEEED8:6992E5E8 |
| html-safe-nonce | 77ec39ec0ec312778bca9268dba056edc746dd8c6e3ce905d34c62bf7fb09fbc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0M4OkFCRkUwOkI5Q0ZBODpGRUVFRDg6Njk5MkU1RTgiLCJ2aXNpdG9yX2lkIjoiNTI2OTE1MjU4NzMwMzgwNjQ0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9fe8cead1d92f1622b0932011b2b747b0c9efc4175d78ad45cf0c9bc9c2d985a |
| hovercard-subject-tag | issue:2764244292 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Sylius/Stack/200/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6002057fe7890a37e3a196324483992a4f2675a67f289facab1300b639c50db1/Sylius/Stack/issues/200 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6002057fe7890a37e3a196324483992a4f2675a67f289facab1300b639c50db1/Sylius/Stack/issues/200 |
| og:image:alt | Description When using the BootstrapAdminUi bundle out of the box, it is a nice DX to not have to install and configure Symfony Stimulus Bundle and care that it exists at all. At some point, when n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brambaud |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/Sylius/Stack git https://github.com/Sylius/Stack.git |
| octolytics-dimension-user_id | 719423 |
| octolytics-dimension-user_login | Sylius |
| octolytics-dimension-repository_id | 434184460 |
| octolytics-dimension-repository_nwo | Sylius/Stack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 434184460 |
| octolytics-dimension-repository_network_root_nwo | Sylius/Stack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84dcb133269e3cfe6e0296cc85fbacb92cae92bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width