ic-get-from does not respect dependencies
mattburton opened this issue · 5 comments
From the documentation here:
http://intercoolerjs.org/attributes/ic-get-from.html
ic-get-from implies a dependency on its path, and Intercooler will issue requests for elements whenever it detects an action that the path depends on. See Dependencies for more information.
What happens in my experience though is that ic-deps
gets set to ignore
on an element using ic-get-from
instead of ic-src
to specify the source of an element. I hit this today - at some point I got in the habit of using ic-get-from
instead of ic-src
for whatever reason and had a setup where the dependency tracking should have kicked in - a delete button in a list type of scenario and the only way I could get it to work was explicitly setting ic-deps
at each level. Once I switched to ic-src
for loading the list it worked without a hitch.
Thanks!
Hi Matt,
Can you explain which way you were expecting dependencies to work? In ic-get-from should be ignored as a dependency (since it does not imply a mutation) but should refresh on a dependent mutation.
You shouldn't need to us ic-src is a "raw" version of ic-get-from, so you can use that to issue a get and still get dependencies to fire.
Sure - I'll describe the situation of the use case - if I'm understanding you correctly I might have it backwards, but just in case:
Typical list view scenario, let's say it's a fragment loaded into a div via ic-get-from
set to /list
with ic-trigger-on
set to load
. Then a delete button on a list item with ic-delete-from
set to /list/<id>
- click the button, item deleted, but the list fragment from /list
isn't reloaded in the div. Inspecting the div in developer tools shows that ic-deps
is set to ignore
. If I change the div from ic-get-from
to ic-src
then it works as expected - click the delete button and the list is automagically reloaded.
Just to clarify, the delete button is on the list item within the fragment that got loaded into the div if that matters, not outside the div.
Ugh, it looks like the docs were just wrong here. ic-get-from has always ignored dependencies, I need to spend some time looking through my notes to understand why.
I need to buff out some content on the difference between ic-src and ic-get-from, that's very confusing. Anyway, switching to ic-src is the right thing. Sorry for the confusion
Alright - no worries - ic-src
is working perfectly so I'll just remember to use that from now on in these situations - although I guess I have to ask if ic-get-from
is supposed to ignore dependencies then what is the use case where one should use ic-get-from
as opposed to ic-src
? Thanks!