Skip to content
Snippets Groups Projects
Commit 76a10408 authored by Manon Bourgognon's avatar Manon Bourgognon
Browse files

update: store reactivity section fixed

parent 79bae998
No related branches found
No related tags found
1 merge request!94Update store reactivity page
...@@ -144,17 +144,17 @@ The store is reactive. It means that any change you make on a resource in your a ...@@ -144,17 +144,17 @@ The store is reactive. It means that any change you make on a resource in your a
However, there are some limitations: However, there are some limitations:
* If you make some changes on a resource which is in a virtual container, other virtual containers including this resource may not be updated. (ie: POST on ``circles/1/members`` does not update ``users/admin/circles/``) * If you make some changes on a resource which is in a virtual container, other virtual containers including this resource may not be updated. (ie: POST on ``circles/1/members`` does not update ``users/admin/circles/``)
* If a resource a multi nested field is displayed in a component, it may not be updated. (ie: in a ``sib-display``, I display ``nestedResource.user.name`` from ``resource``, changing ``user`` will not update the display) * If a resource having a multi nested field is displayed in a component, it may not be updated. (ie: in a ``sib-display``, I display ``nestedResource.user.name`` from ``resource``, changing ``user`` will not update the display)
In response to these two cases, the store function ``subscribeVirtualContainerTo(arg1, arg2)`` allows changes in one resource to be passed on to another reactively : In response to these two cases, the store method ``subscribeVirtualContainerTo(arg1, arg2)`` allows changes in one resource to be passed on to another reactively:
- ``arg1`` is the resource to be updated according to ``arg2``, - ``arg1`` is the resource to be updated according to ``arg2``,
- ``arg2`` is the starting resource, the model to copy. - ``arg2`` is the starting resource, the model to copy.
The following example illustrates the reactivity of a component displaying job offers. The following example illustrates the reactivity of a component displaying job offers.
A resource contains all the job offers displayed (``resource1``), another resource is for job offers created (``resource2``). Each time a job offer is created (added to ``resource2``), the job offers list displayed (``resource1``) needs an update: A container is providing a list of job offers (``http://localhost/job-offers/active/``), another endpoint is used to create new job offers (``http://localhost/job-offers/``). Each time a job offer is created (added to ``http://localhost/job-offers/``), the displayed list of job offers (``http://localhost/job-offers/active/``) requires an update:
.. code:: javascript .. code:: javascript
core.store.subscribeVirtualContainerTo(resource1, resource2); core.store.subscribeVirtualContainerTo(http://localhost/job-offers/active/, http://localhost/job-offers/);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment