Skip to content

View Interoperability in Compose #153

Description

@fransp1

Updating an existing Juice in the final application does not work because the juice instance passed to SheetForm is stale, but is copied into the view model's _currentJuiceStream by the combined behaviors of SheetForm's various ...InputRow.on...Change lambdas and the view model updateCurrentJuice function passed to SheetForm as lambda parameter onUpdateJuice by EntryBottomSheet.
This can be corrected by changing the 'juice: Juice' parameter of SheetForm to 'juiceFlow: StateFlow' and adding 'val juice by juiceFlow.collectAsState()' to the function body. Also change calling parameter 'juice = juice' in the invocation of SheetForm in EntryBottomSheet to 'juiceFlow = juiceTrackerViewModel.currentJuiceStream'. 'val juice by juiceTrackerViewModel.currentJuiceStream.collectAsState()' can then be removed from EntryBottomSheet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions