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

Component prop marked as observable.ref can cause performance issues #3769

Open
saba-mo opened this issue Aug 28, 2024 · 4 comments
Open

Component prop marked as observable.ref can cause performance issues #3769

saba-mo opened this issue Aug 28, 2024 · 4 comments
Assignees

Comments

@saba-mo
Copy link
Contributor

saba-mo commented Aug 28, 2024

Passing an object marked as @observable.ref as a component prop and then accessing it in the top-level component via a getter on the model causes the component's render method to get called in an infinite loop. This was noticed in a client app that was experiencing performance issues.

The toolbox branch cmpProps reproduces the issue - just uncomment line 9 destructuring the getter from the model in DetailsPanel.ts in the Recalls example directory.

Steps to reproduce the issue:

  • Object marked as @observable.ref that gets set in its loadAsync method is passed as a component prop.
  • The receiving component creates its model, and accesses the component prop via a getter on the model.
  • The receiving component accesses the object from its model in the component's top level render method.

Note that in the client app, the presence of auto refresh seemed to be required to create this loop; however, I'm not sure that's the case in the toolbox example as it seems to happen immediately.

@amcclain
Copy link
Member

How interesting! Staying tuned - thanks for the comprehensive write up.

@amcclain
Copy link
Member

@saba-mo just checking to see if you got any more details here - is it still an actionable Hoist ticket? I didn't want to let it fall through the cracks.

@saba-mo
Copy link
Contributor Author

saba-mo commented Sep 16, 2024

No additional details yet. @lbwexler, do you want to look together?

@lbwexler
Copy link
Member

lbwexler commented Sep 16, 2024 via email

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

3 participants