Skip to content
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

Getters getting triggered on n-dimensional maps #187

Open
pbeets opened this issue Nov 4, 2015 · 5 comments
Open

Getters getting triggered on n-dimensional maps #187

pbeets opened this issue Nov 4, 2015 · 5 comments

Comments

@pbeets
Copy link

pbeets commented Nov 4, 2015

Seems like the refactor of reactor now triggers getters whenever a change happens at the root level.

For ex:

export default {
  getter: [['key1', 'key2', 'key3'], item => item]
}

version 1.1.2 and before, will only get triggered when ['key1', 'key2', 'key3'] has changed.

version 1.2.0 the above getter is triggered when anything in ['key1'] changes. This is undesirable as even if key3 has not been set it will still receive and update a bound state with undefined.

@jordangarcia
Copy link
Contributor

Hey Pbeets,

Under the hood the getter evaluation mechanism has changed, however it shouldn't be calling a change handler (via observe) unless the value of the getter has changed?

Can you elaborate a bit more on how you are consuming this getter, are you evaluate or observe or using ReactMixin?

This seems like a pretty serious issue to me, it'd be great to have more context.

@pbeets
Copy link
Author

pbeets commented Nov 4, 2015

@jordangarcia I'm consuming it via getDatabindings / ReactMixin. However using an observe seems to have the same effect.

The getters are setup before hand so the data it's supposed to get doesn't exist yet.

@jordangarcia
Copy link
Contributor

What type of data is being returned, you mentioned that it was undefined?

If you could post an example of the store / getter that would help a lot

On Wednesday, November 4, 2015, pbeets [email protected] wrote:

@jordangarcia https://github.com/jordangarcia I'm consuming it via
getDatabindings / ReactMixin. However using an observe seems to have the
same effect.


Reply to this email directly or view it on GitHub
#187 (comment)
.

@pbeets
Copy link
Author

pbeets commented Nov 25, 2015

Unable to reproduce. Looks like it was a problem on my end.

@pbeets pbeets closed this as completed Nov 25, 2015
@pbeets
Copy link
Author

pbeets commented Nov 26, 2015

@jordangarcia Alright, finally figured out the condition. Looks like for particular set of combine functions, the getter handler is being called regardless.

I've added an example:
https://gist.github.com/pbeets/2682c0fb5b8243c165a1

@pbeets pbeets reopened this Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants