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

Set the ComposeSceneLayer's content in DisposableEffect rather than in the composition #1272

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

m-sasha
Copy link

@m-sasha m-sasha commented Apr 16, 2024

We currently set the ComposeSceneLayer's content in the composition phase of its parent. This causes the initial state reads and writes of the child composition to register in the parent composition, which then breaks recomposition when the values of these states changes.

See the discussion in Slack.

RelNote: Fix initial composition of Dialog to correctly respond to changes of states that were both written and read in it. This fixes, for example, DateRangePicker ignoring first date change after being shown.

Proposed Changes

Move setting the layer's content into a DisposableEffect.

Testing

Test: Tested manually and added a new unit test.

Issues Fixed

Fixes: JetBrains/compose-multiplatform#4609

@m-sasha m-sasha force-pushed the m-sasha/fix-new-composition-setup branch from e4ed692 to 4cc3e32 Compare April 16, 2024 11:46
@m-sasha m-sasha requested review from igordmn, igoriakovlev and MatkovIvan and removed request for igoriakovlev April 16, 2024 11:46
@m-sasha m-sasha force-pushed the m-sasha/fix-new-composition-setup branch from 4cc3e32 to 38fca69 Compare April 16, 2024 14:03
@m-sasha m-sasha force-pushed the m-sasha/fix-new-composition-setup branch from 38fca69 to f297f73 Compare April 16, 2024 14:03
@m-sasha m-sasha merged commit 11a0365 into jb-main Apr 17, 2024
6 checks passed
@m-sasha m-sasha deleted the m-sasha/fix-new-composition-setup branch April 17, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants