Skip to content

onChange alway use old props #153

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

Closed
nodece opened this issue Sep 2, 2019 · 2 comments
Closed

onChange alway use old props #153

nodece opened this issue Sep 2, 2019 · 2 comments

Comments

@nodece
Copy link

nodece commented Sep 2, 2019

Online code in https://codesandbox.io/s/casbin-9r1ul
Preview in https://9r1ul.csb.app/

Log:

New Props 
▶Object {model: "basic"}
New Props 
▶Object {model: "basic_without_resources"}
Should use Latest Props 
▶Object {model: "basic"}
setModelCache basic 
New Props 
▶Object {model: "rbac"}
Should use Latest Props 
▶Object {model: "basic_without_resources"}
setModelCache 

console.log in src/editor/model.tsx

@nodece nodece changed the title onChange alway onChange alway use old props Sep 2, 2019
@schnerd
Copy link

schnerd commented Dec 13, 2019

Likely duplicate of #142

(FWIW I'm experiencing this too when using hooks)

@nodece
Copy link
Author

nodece commented Dec 14, 2019

@schnerd I use the import { Controlled as CodeMirror } from 'react-codemirror2';. It is working.
See: https://github.com/nodece/casbin-editor/blob/master/src/editor/editor.tsx

@nodece nodece closed this as completed Dec 14, 2019
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