This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for reearth-web ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov Report
@@ Coverage Diff @@
## main #269 +/- ##
=======================================
Coverage 52.19% 52.19%
=======================================
Files 56 56
Lines 1205 1205
Branches 193 193
=======================================
Hits 629 629
Misses 503 503
Partials 73 73 |
I have tested. It seems to work fine. |
KaWaite
reviewed
Jul 11, 2022
KaWaite
reviewed
Jul 11, 2022
KaWaite
reviewed
Jul 11, 2022
rot1024
suggested changes
Jul 11, 2022
Co-authored-by: rot1024 <aayhrot@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
KaWaite
reviewed
Jul 11, 2022
KaWaite
approved these changes
Jul 11, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com>
rot1024
approved these changes
Jul 11, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The
jump
button on camera pop-up pane doesn't work.After some digging i found this bug comes from another PR which was aiming at fix the view flash.
jump
bug. And again facing the view flash issue.About the view flash issue I think it comes from the useEffect of global state
camera
(with Jotai) is somehow optimized after upgrade to React18. Here's some description in detail:Please correct me if i have anything misunderstood.
We have two camera related in this issue:
The data transfers in both way in different situations:
Considering these two things together: moving the earth -> Visualizer camera changed -> update global camera -> useEffect fired -> update Visualizer camera. This become a loop. So there is a condition in useEffect and also a cache of camera which called emittedCamera , it will store the last emit from Visualizer so when the useEffect fired it can check if the global camera is equal to Visualizer emitted one. And if so skip the flyto .
This solution works fine before as the state updates as we expected. But after upgrade to React18, the global state change become some async. eg:
What i can see for now for solution:
Since the data got from
useEffect
is no longer reliable, using one single data to do the check is not enough. Using opt.4 seems better otherwise we need to add another global state as flag and passing it everywhere which i think will make the code more complex.In general, I currently implement this with option 4.
What I've done
useEffect
ofcamera
to update Visualizer camera when global camera changes.emittedCamera
into an array to cache recent emitted values as the camera got insideuseEffect
can be several versions lag behind now.What I haven't done
How I tested
jump
on camera pop-up pane (even when the moving camera animation havn't finish).Screenshot
Which point I want you to review particularly
Memo