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

State on IDidUpdate\WillUpdate #24

Closed
amakurin opened this issue Dec 28, 2013 · 6 comments
Closed

State on IDidUpdate\WillUpdate #24

amakurin opened this issue Dec 28, 2013 · 6 comments

Comments

@amakurin
Copy link

@amakurin amakurin commented Dec 28, 2013

I've found strange behaviour of states on IDidUpdate and IWillUpdate.
Did: prev-state is always same as current state.
Will: when i'm printing whole next-state object to console i'm seeing state that should be (realy will-state) but when i'm accessing it through (.-__om_state next-state) i recieve same state as current, same way as Did.
Maybe there is another "true" way to accessing this states...

@swannodette
Copy link
Member

@swannodette swannodette commented Dec 28, 2013

How are you trying to set component state?

Note I'm still on the fence as to precisely what the life-cycle methods will expose, Om internals or React internals. I'm leaning towards Om internals - if you want React internals just use React.

@amakurin
Copy link
Author

@amakurin amakurin commented Dec 28, 2013

(om/set-state! owner [:select-visible] true)
I guess it is Om way. But i didn't found something like om/get-state for accessing prev-state\next-state, so i'm using (.-__om_state next-state)

@swannodette
Copy link
Member

@swannodette swannodette commented Dec 28, 2013

@amakurin ok, so this confirms my suspicion that we should hand Om users Om prev-state/next-state instead and not React's.

@amakurin
Copy link
Author

@amakurin amakurin commented Dec 28, 2013

Yep. I guess so.

@asolove
Copy link

@asolove asolove commented Dec 28, 2013

As a data point: I'm doing the same thing to get the Om state, have never needed anything else out of the React state, and would appreciate getting it directly.

@swannodette
Copy link
Member

@swannodette swannodette commented Dec 29, 2013

Fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants