-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
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
1.0.0-rc1: v-for + filters + .sync does not work as expected #1433
Comments
I was "fiddling" around in your jsfiddle and got the following error The result of the filter is not bound to the current vm so there can't be a 2 way bind. There are better ways to solve the problem that you are facing |
@marcvdm that is exactly how I worked it around in my app, but it still is a workaround, not a solution. Btw, the warning does not show in my fiddle. You replaced |
Hmm. I think, a watcher should be created with "deep" option to fix it (instead of "shallow" watcher). Am I right? |
This is a use case that is by design not going to work. "deep" has nothing to do with this. Two-way bindings on a filtered copy doesn't really make sense. I anticipated cases like this but your usage somehow bypassed the warning check ;) It will give a warning in such scenarios now. |
@yyx990803 may be there's still some kind of a solution for this? I think it's possible to deep-watch for changes in the filtering result, and then run the write filter to re-assign the initial value. |
@yyx990803 and I don't see reasons (other than code complexity) why should not it work. I think of it the next way: We have an initial object, which is passed through a filter to build a new one (or an array), which is then iterated by |
Yes, this is a marignally useful feature that involves a lot of code complexity - maybe requires rewriting some parts of how filters work. Although theoretically it "should" work, given the limited time I have I don't see it ever become a priority in the foreseeable future. You are free to investigate and submit a PR if you feel it's worth the effort. |
Okay, i'll look for a solution for this thing.
|
This fiddle: http://jsfiddle.net/kyhqq375/ is expected to change "Items: one, two" when clicking buttons, but "write" filter is never called, and "one, two" is never changed. Obviously, not a simple use case, but it should work or at least show a warning...
The text was updated successfully, but these errors were encountered: