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

Multiple Range Latency #383

Open
iM-GeeKy opened this issue Apr 25, 2024 · 9 comments
Open

Multiple Range Latency #383

iM-GeeKy opened this issue Apr 25, 2024 · 9 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed high priority repro provided Reproducible example provided

Comments

@iM-GeeKy
Copy link
Collaborator

iM-GeeKy commented Apr 25, 2024

Current behaviour

The multiple dates picker appears to gradually get slower the more dates that are selected. This seems to be more noticeable on iOS as opposed to Android and Web.

Expected behaviour

The dates should be selected in a reasonable time.

How to reproduce?

https://snack.expo.dev/@fitzwabs/react-native-paper-dates-multiple-picker or it also seen in the repositories example app.

Preview

Screen_Recording_2024-04-14_at_11.56.43_AM.mov

What have you tried so far?

@RichardLindhout I haven't looked into this yet, but I'm assuming it is performing a lot of re-renders. Perhaps you have more insight off the top of your head.

Your Environment

software version
ios 17.4
android 14.0
react-native 0.73.6
react-native-paper 5.12.3
node 20.10.0
npm or yarn yarn
expo sdk 50.0.17
@iM-GeeKy iM-GeeKy added bug Something isn't working needs repro Needs reproducible example labels Apr 25, 2024
Copy link
Contributor

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.dev. If it's not possible to repro it on snack.expo.dev, then you can also provide the repro in a GitHub repository.

@iM-GeeKy iM-GeeKy added repro provided Reproducible example provided and removed needs repro Needs reproducible example labels Apr 25, 2024
@iM-GeeKy iM-GeeKy added help wanted Extra attention is needed high priority labels May 5, 2024
@iM-GeeKy
Copy link
Collaborator Author

iM-GeeKy commented May 5, 2024

@RichardLindhout Do you have any initial thoughts?

@iM-GeeKy
Copy link
Collaborator Author

@RichardLindhout Do you have any insight into this? I'm going to try to fix this in the next couple of weeks as it's affecting my app and any ideas you might have will serve as a good starting point.

@RichardLindhout
Copy link
Member

Hey! It is probably because array will re-render everything because some property is not stable 'enough' so something triggers the day to re-render. I thought we only used simple promps in day to prevent this but maybe something else is slow

@iM-GeeKy
Copy link
Collaborator Author

iM-GeeKy commented Jul 1, 2024

Hey! It is probably because array will re-render everything because some property is not stable 'enough' so something triggers the day to re-render. I thought we only used simple promps in day to prevent this but maybe something else is slow

Yeah, I'm still looking into it but I've noticed that this renders 5 times (

const grid = React.useMemo(() => {
) and if I decrease
return [i - 2, i - 1, i, i + 1, i + 2]
it will render faster obviously b/c it's not drawing all the months again. I'm still digging, but I'm trying to get it fixed!

@RichardLindhout
Copy link
Member

RichardLindhout commented Jul 1, 2024

Do the days also re-render? I think thats the biggest bottleneck

@iM-GeeKy
Copy link
Collaborator Author

iM-GeeKy commented Jul 1, 2024

I'll have to put some logs in. I just know it only happens on iOS and the rendering of grid gets increasingly slower, but perhaps the days is the real culprit. The multiple on iOS is borderline unusable after only a few dates have been selected so I'd let to get to the bottom of it.

@iM-GeeKy
Copy link
Collaborator Author

iM-GeeKy commented Jul 2, 2024

It appears its rendering all the days again for each month, so I'll have to explore how we can avoid that from happening.

@iM-GeeKy
Copy link
Collaborator Author

iM-GeeKy commented Jul 3, 2024

Any ideas? It seems strange it only happens on iOS when the all the re-renders are happening on both platforms...It looks like it goes through this loop with rendering all of the days for each month again on selection

{grid.map(({ weekIndex, generatedDays }) => (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed high priority repro provided Reproducible example provided
Projects
None yet
Development

No branches or pull requests

2 participants