Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5def44c3 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

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
parent 4b9cd743
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment