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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions