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

[Performance] Refactor withWindowDimensions to drop event subscription in each instance. #4121

Closed
parasharrajat opened this issue Jul 16, 2021 · 6 comments
Labels
Planning Changes still in the thought process

Comments

@parasharrajat
Copy link
Member

parasharrajat commented Jul 16, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


ISSUE

withWindowDimensions subscribe to Dimension change directly in each instance. There is no apparent issue with this. But It is really not necessary and delays react updates. This component will cause a series change in React components instead they can be updated at once.

There is also a performance drop due to having multiple subscriptions. I suggest we use Context-based state sharing for this. This is a new pattern for our app. But we already using with some vendor Libs already.

There are some good points by @jsamr #4106 (comment) & #4106 (comment). A little more context #4106 (comment). There was an old case where the app crashed due to this #2902.

I insist to do this change as if there is a way to improve this code and it is giving an advantage without too much overhead then we should do this.

Expected Result:

Describe what you think should've happened
Remove multiple Dimension change subscriptions.

Platform:

Where is this issue occurring?

Web ✔️
iOS ✔️
Android ✔️
Desktop App ✔️
Mobile Web ✔️

Version Number: latest

View all open jobs on Upwork

cc: @marcaaron

@parasharrajat parasharrajat added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 16, 2021
@MelvinBot
Copy link

Triggered auto assignment to @sakluger (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 16, 2021
@marcaaron
Copy link
Contributor

marcaaron commented Jul 16, 2021

Thanks @parasharrajat this sounds pretty similar to the issue opened here by @kidroca (which we ended up not prioritizing).

Are you proposing something different?

There is also a performance drop due to having multiple subscriptions.

What are the impacts? Is it something we can benchmark and prove? And is it something we should prioritize?

@marcaaron
Copy link
Contributor

Also is there some specific experience metric we can tie this to and apply it as a solution... e.g. does it make chat switching faster? Does it make the app boot faster? Does it make report actions load faster? These are the areas we are prioritizing. So it would be nice see this presented as a solution to one of our open issues.

@marcaaron marcaaron added the Planning Changes still in the thought process label Jul 16, 2021
@parasharrajat
Copy link
Member Author

ok. I will try to match it with something but I guess we can close it and continue there if there is an existing issue. Please feel free to close it if you agree.

@marcaaron
Copy link
Contributor

Let me know how it goes. I've put a Planning label on this for now and raised some discussion in Slack. I think a good issue title should be something like:

[Performance] Improve [insert actual feature] time by refactoring withWindowDimensions

@marcaaron
Copy link
Contributor

Actually going to close this. If you have some new metrics or benchmarks feel free to reopen the other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Planning Changes still in the thought process
Projects
None yet
Development

No branches or pull requests

4 participants