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

Custom values with setDpr are overridden with dpr prop on rerender #3099

Open
nhtoby311 opened this issue Nov 20, 2023 · 0 comments
Open

Custom values with setDpr are overridden with dpr prop on rerender #3099

nhtoby311 opened this issue Nov 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@nhtoby311
Copy link

I'm trying to create a component, that can setDpr, based on current graphics settings. I copied the implementation from AdaptiveDpr in drei. I noticed that when using this in an app, which of course, have multiple states update (unrelated to this component), the switching Dpr became not consistent, as sometimes it does not apply any thing but it should be. This happened clearly on route changes.

I have created a codesandbox for this: https://codesandbox.io/p/devbox/setdpr-issue-with-state-changes-4643zz?file=%2Fpages%2F_app.tsx%3A12%2C1 - it's Next.js

GraphicSettings on leva will controls how low dpr it is, which is in the Downscale.tsx. To see clearly the issue, changes the route at top left corner to go between Home and About. Swap couple of few times and there will be the inconsistent bug as the downscaled dpr is not applied. This doesn't seem to happened if I comment out the frequent state update at _app.tsx

I attached the video below to be clearer.

dpr.mp4
@CodyJasonBennett CodyJasonBennett added the bug Something isn't working label Nov 22, 2023
@CodyJasonBennett CodyJasonBennett changed the title setDpr is not consistent under multiple states update within the app. Custom values with setDpr are overridden with dpr prop on rerender Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants