@@ -2333,6 +2333,15 @@ component, for example: ``https://my.domain/search?query=my+search+string``.
2333
2333
Then, if you load this URL in your browser, your component will be initialized with the values provided in the query
2334
2334
string.
2335
2335
2336
+ .. note ::
2337
+
2338
+ URL is updated in place, no new entry is added to the browser's history.
2339
+
2340
+ .. warning ::
2341
+
2342
+ You can use multiple components with URL bindings in the same page, as long as bound field names don't collide.
2343
+ Otherwise, you will observe unexpected behaviors.
2344
+
2336
2345
Supported data types
2337
2346
~~~~~~~~~~~~~~~~~~~~
2338
2347
@@ -2357,7 +2366,7 @@ Multiple bindings
2357
2366
~~~~~~~~~~~~~~~~~
2358
2367
2359
2368
You can use as many URL bindings as you want in your component. To ensure the state is fully represented in the URL,
2360
- all bound props will be added to query parameters, even if their values didn't change.
2369
+ all bound props will be set as query parameters, even if their values didn't change.
2361
2370
2362
2371
For example, if you declare the following bindings::
2363
2372
@@ -2380,6 +2389,11 @@ And you only set the ``query`` value, then your URL will be updated to ``https:/
2380
2389
Validation
2381
2390
~~~~~~~~~~
2382
2391
2392
+ .. caution ::
2393
+
2394
+ It is recommended to validate data provided through query string parameters, so you can prevent malicious inputs
2395
+ from being processed and rendered.
2396
+
2383
2397
To validate your component state when it is rendered for the first time, you have to setup a `PostMount hook `_::
2384
2398
2385
2399
// ...
@@ -2409,6 +2423,9 @@ To validate your component state when it is rendered for the first time, you hav
2409
2423
// ...
2410
2424
}
2411
2425
2426
+ .. note ::
2427
+
2428
+ You can use `validation groups `_ if you want to use specific validation rules only in the PostMount hook.
2412
2429
2413
2430
.. _emit :
2414
2431
@@ -3424,3 +3441,4 @@ bound to Symfony's BC policy for the moment.
3424
3441
.. _`pass content to Twig Components` : https://symfony.com/bundles/ux-twig-component/current/index.html#passing-blocks
3425
3442
.. _`Twig Component debug command` : https://symfony.com/bundles/ux-twig-component/current/index.html#debugging-components
3426
3443
.. _`PostMount hook` : https://symfony.com/bundles/ux-twig-component/current/index.html#postmount-hook
3444
+ .. _`validation groups` : https://symfony.com/doc/current/form/validation_groups.html
0 commit comments