-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ViewFactory does not invalidate cache after the factories template changed #595
Comments
@EisenbergEffect & @jdanyow |
@EisenbergEffect I don't think so, but since I need touch support and there is an issue with touch listeners and removed html elements I'm pretty much depending on the caching mechanism. |
@bigopon @EisenbergEffect Any updates regarding this? As @itfourp said if you need touch support this needs to be fixed. Do we know where in the view cache mechanism we need to fix this? |
I don't think anyone has had a chance to look into this deeply yet. |
Because the issue is in the repaceable part, which is nested inside repeated element, it's quite difficult to work out. Maybe we can fix |
@EisenbergEffect What about we introduces a special attribute similar to <div repeat.for='item of items' separate-cache>
...
</div> |
I'd be willing to entertain this idea. It is an edge case, so I'm not sure it's worth it to re-write the entire system. But if we can enable a simple setting like this, then the few people who really need this can opt in. |
Maybe it should be a named cache? |
It's not a rewrite, I think it can simply be some extra arguments around caching and retrieving cache in view factory |
That seems ok. Do you want to have a go at it? |
I'll give it a shot after the current feature set |
I'm very happy you've already got some ideas to fix this issue. If you're interested I could set up another gist or a github project that makes use of touchy-stuff and you could use to test your solution on. |
@itfourp No rush and that'd be great 👍 |
Sorry, I completely forgot to mention I'm done with the setup of the touch-demonstration project for this issue. Please see here. If anything does not work as expected feel free to tell me. |
@itfourp Nice. Thanks! |
@itfourp I'm unable to reproduce the issue as you can see from this demo https://dist-ouuggzgmue.now.sh/ |
@bigopon I am sorry my instructions have been unclear. In this example I've already set the view-cache to 0 in the sort-container.html to show the touch issues that occur with disabled view caching. To reproduce the behavior I reported here please just re-enable the caching. |
Thanks @itfourp , I haven't got around to fix the issue, but I'll try to summarize the issue first for some discussion, before starting that work. The normal usage of
|
I'd like @fkleuver's thoughts on this, particularly as it pertains to vNext. If possible I think we should endeavor to solve this for vNext and backport to vCurrent so that our solution here is forward-compatible and so that this usage scenario is captured and handled going forward (no regression in vNext). I'm not particularly fond of the API above 😏 So, some further design thinking on that would be nice. Ideally, the option wouldn't need to be specified at all. We'd just detect that there's a replaceable part involved and automatically create a named cache to handle this behind the scenes. |
For a sortable/draggable repeater in vNext, you would use keyed mode. This reorders the elements instead of re-binding them and thereby retains the element state (event listeners, css, etc). That simplifies this situation a lot. For caching views in keyed mode, my immediate thought is: Regarding the edge case with nested To make all of this work in vCurrent I do see the possibility of backporting keyed mode (this might even be easier to do in vCurrent than it was in vNext because there is less lifecycle order/timing stuff to account for) as well as having a Without keyed mode, I'm not sure if we should even try. This is the primary use case for keyed mode. That inherently brings with it a key. I think that takes away a fair amount of design uncertainties. @bigopon maybe either you or me should port @itfourp 's repro to vNext and see if it already works or not. In any case vNext is much closer to being able to deal with this already than vCurrent is, so we should look there first imo. |
I think I've stumbled upon something related to this issue, but for now managed to work around it. Just wanted to know if there has been anything done about this that perhaps I could try, before elaborating more on my specific case (which involves both sorting [through a value converter] and replaceable parts in a probably pretty advanced way... 😬). In short, the issue is with checked bindings for a set of radiobuttons inside one of those replaceable parts, in each of the sorted items). ping @bigopon |
I'm submitting a bug report
1.7.0
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
6.10.2
NPM Version:
5.3.0
JSPM OR Webpack AND Version
JSPM 0.16.53
Browser:
all
Language:
all
Current behavior:
Using custom elements in multiple repeats with view-cache enabled causes weird behaviour when different templates are used for each repeat and items are moved from one repeat to the other one.
I guess the fragment of the cached view is not updated when the element was moved from one repeat to another.
This bug first occurred when I was using the oribella-aurelia-sortable library that uses a repeat with enabled cache to ensure touch-support is working correctly (see furthermore here and here).
Expected/desired behavior:
For an example for both expected and current behaviour and how to reproduce please see here: https://gist.run/?id=2cd8a03e16f92ce64308f9ec841c3b70
What is the expected behavior?
We could invalidate the cache when the template of the ViewFactory has changed so the ViewFactory is forced to re-create the view, but I am not sure if the will break touch-support yet again.
What is the motivation / use case for changing the behavior?
To ensure the oribella-aurelia-sortable library can be used with touch support.
The text was updated successfully, but these errors were encountered: