summaryrefslogtreecommitdiff
path: root/libs/input/SpriteController.cpp
diff options
context:
space:
mode:
author Jordan Demeulenaere <jdemeulenaere@google.com> 2023-12-27 13:40:51 +0100
committer Jordan Demeulenaere <jdemeulenaere@google.com> 2024-01-03 11:56:47 +0100
commit5def44c3e6d959231237833d45f36f5efecd4cec (patch)
tree4c1898fb884b8a12b8011b7772129fd06340cbbb /libs/input/SpriteController.cpp
parent4b9cd7432fe26000ad71abdd01e3eb99eff957f1 (diff)
Replace AnimatedState.valueOrNull by unsafeCompositionState (1/2)
This CL replaces AnimatedState.valueOrNull by a new function unsafeCompositionState() that returns a State that won't throw if it is read during composition. This ensures that callers don't try to access this value when the associated Element object is not in its map yet, which would happen once we add the Element in a DisposableEffect or in a Node.onAttach() method. Before this CL, values coming from valueOrNull could sometimes be one frame behind and sometimes not, depending on timings and composition order. With this CL, values read through unsafeCompositionState() will consistently be one frame behind. That way, the behavior is consistent and easy to reason about. Bug: 291071158 Test: AnimatedSharedAsStateTest Flag: N/A Change-Id: I75dcadaabdd6b3d314744fdde336b79115af0755
Diffstat (limited to 'libs/input/SpriteController.cpp')
0 files changed, 0 insertions, 0 deletions