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

useAsImmutable Not Detecting #12

Open
selsamman opened this issue Feb 20, 2024 · 0 comments
Open

useAsImmutable Not Detecting #12

selsamman opened this issue Feb 20, 2024 · 0 comments

Comments

@selsamman
Copy link
Owner

useAsImmutable detects when any sub-ordinate properties are changed but not when the property itself changes.

For example:

   const news = observable({
            topics: ["politics", "tech", "cooking"],
            results: ""
        });
        const App = observer( function App () {
            useLayoutEffect( () => {
                    news.results = news.topics.join(",");
                }, [useAsImmutable(news.topics)]
            );
            return (<div>{news.results}</div>);
        });
  

Adding a new new topic will work as expected and fire the effect but replacing news.topics with a new array is not detected.

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

1 participant