You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #3049 [LiveComponent] Clean versionadded (smnandre)
This PR was merged into the 2.x branch.
Discussion
----------
[LiveComponent] Clean versionadded
| Q | A
| ------------- | ---
| Bug fix? | yes/no
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
| Docs? | yes
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
(they predate the first stable release...)
Commits
-------
9d3bd0f [Docs][LiveComponent] Clean oldies version added
The ability to use the ``defaults()`` method with ``stimulus_controller()``
945
-
was added in TwigComponents 2.9 and requires ``symfony/stimulus-bundle``.
946
-
Previously, ``stimulus_controller()`` was passed to ``attributes.add()``.
947
-
948
924
To add a custom Stimulus controller to your root component element:
949
925
950
926
.. code-block:: html+twig
@@ -1315,10 +1291,6 @@ shortcuts. We even added a flash message!
1315
1291
Uploading files
1316
1292
---------------
1317
1293
1318
-
.. versionadded:: 2.11
1319
-
1320
-
The ability to upload files to actions was added in version 2.11.
1321
-
1322
1294
Files aren't sent to the component by default. You need to use a live action
1323
1295
to handle the files and tell the component when the file should be sent:
1324
1296
@@ -1385,7 +1357,9 @@ The files will be available in a regular ``$request->files`` files bag::
1385
1357
Downloading files
1386
1358
-----------------
1387
1359
1388
-
Currently, Live Components do not natively support returning file responses directly from a LiveAction. However, you can implement file downloads by redirecting to a route that handles the file response.
1360
+
Currently, Live Components do not natively support returning file responses
1361
+
directly from a LiveAction. However, you can implement file downloads by
1362
+
redirecting to a route that handles the file response.
1389
1363
1390
1364
Create a LiveAction that generates the URL for the file download and returns a ``RedirectResponse``::
1391
1365
@@ -1410,7 +1384,9 @@ Create a LiveAction that generates the URL for the file download and returns a `
1410
1384
1411
1385
.. tip::
1412
1386
1413
-
When Turbo is enabled, if a LiveAction response redirects to another URL, Turbo will make a request to prefetch the content. Here, adding ``data-turbo="false"`` ensures that the download URL is called only once.
1387
+
When Turbo is enabled, if a LiveAction response redirects to another URL,
1388
+
Turbo will make a request to prefetch the content. Here, adding ``data-turbo="false"``
1389
+
ensures that the download URL is called only once.
1414
1390
1415
1391
1416
1392
.. _forms:
@@ -1781,10 +1757,6 @@ To fix this, set the ``always_empty`` option to ``false`` in your form::
1781
1757
Resetting the Form
1782
1758
~~~~~~~~~~~~~~~~~~
1783
1759
1784
-
.. versionadded:: 2.10
1785
-
1786
-
The ``resetForm()`` method was added in LiveComponent 2.10.
1787
-
1788
1760
After submitting a form via an action, you might want to "reset" the form
1789
1761
back to its initial state so you can use it again. Do that by calling
1790
1762
``resetForm()`` in your action instead of redirecting::
@@ -2379,10 +2351,6 @@ as soon as the page loads (``defer``) or when the component becomes visible
2379
2351
Loading "defer" (Ajax on Load)
2380
2352
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2381
2353
2382
-
.. versionadded:: 2.13.0
2383
-
2384
-
The ability to defer loading a component was added in Live Components 2.13.
2385
-
2386
2354
If a component is heavy to render, you can defer rendering it until after
2387
2355
the page has loaded. To do this, add a ``loading="defer"`` attribute:
2388
2356
@@ -2402,10 +2370,6 @@ real component once the page has loaded.
2402
2370
Loading "lazy" (Ajax when Visible)
2403
2371
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2404
2372
2405
-
.. versionadded:: 2.17.0
2406
-
2407
-
The ability to load a component "lazily" was added in Live Components 2.17.
2408
-
2409
2373
The ``lazy`` option is similar to ``defer``, but it defers the loading of
2410
2374
the component until it's in the viewport. This is useful for components that
2411
2375
are far down the page and are not needed until the user scrolls to them.
@@ -2442,9 +2406,9 @@ You can define some content to be rendered while the component is loading, eithe
2442
2406
inside the component template (the ``placeholder`` macro) or from the calling template
2443
2407
(the ``loading-template`` attribute and the ``loadingContent`` block).
2444
2408
2445
-
.. versionadded:: 2.16.0
2409
+
.. versionadded:: 2.16
2446
2410
2447
-
Defining a placeholder macro into the component template was added in Live Components 2.16.0.
2411
+
Defining a placeholder macro into the component template was added in Live Components 2.16.
2448
2412
2449
2413
In the component template, define a ``placeholder`` macro, outside of the
2450
2414
component's main content. This macro will be called when the component is deferred:
@@ -2562,10 +2526,6 @@ You can also trigger a specific "action" instead of a normal re-render:
2562
2526
Changing the URL when a LiveProp changes
2563
2527
----------------------------------------
2564
2528
2565
-
.. versionadded:: 2.14
2566
-
2567
-
The ``url`` option was introduced in Live Components 2.14.
2568
-
2569
2529
If you want the URL to update when a ``LiveProp`` changes, you can do that with the ``url`` option::
2570
2530
2571
2531
// src/Twig/Components/SearchModule.php
@@ -3710,10 +3670,6 @@ Then specify this new route on your component:
3710
3670
use DefaultActionTrait;
3711
3671
}
3712
3672
3713
-
.. versionadded:: 2.14
3714
-
3715
-
The ``urlReferenceType`` option was added in LiveComponents 2.14.
3716
-
3717
3673
You can also control the type of the generated URL:
3718
3674
3719
3675
.. code-block:: diff
@@ -3733,10 +3689,6 @@ You can also control the type of the generated URL:
3733
3689
Add a Hook on LiveProp Update
3734
3690
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3735
3691
3736
-
.. versionadded:: 2.12
3737
-
3738
-
The ``onUpdated`` option was added in LiveComponents 2.12.
3739
-
3740
3692
If you want to run custom code after a specific LiveProp is updated,
3741
3693
you can do it by adding an ``onUpdated`` option set to a public method name
3742
3694
on the component::
@@ -3836,10 +3788,6 @@ The `Twig Component debug command`_ can help you.
0 commit comments