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

Suspend children #122

Merged
merged 10 commits into from
Sep 8, 2022
Merged

Suspend children #122

merged 10 commits into from
Sep 8, 2022

Conversation

CherryPerry
Copy link
Collaborator

@CherryPerry CherryPerry commented Aug 31, 2022

Description

Simple implementation with either keep all or suspend all.

  1. New KeepMode is introduced to specify keep logic of stashed (not visible) nodes. The value is passed directly into ParentNode.
  2. ChildEntry is refactored into Initialized and Suspended.
  3. ChildNodeCreationManager creates a snapshot of currently initialized and suspended nodes and compares it with the provided by nav model list. After calculating a diff, it applies required changes.
  4. Simple tests to verify behaviour.
  5. Appyx class moved to the root package and allows to setup default behaviour.

Fixes #111
Fixes #120

Strategies

As a separate PR please, this one defines a foundation for further updates and allows faster feedback.

Check list

  • I have updated CHANGELOG.md if required.
  • I have updated documentation if required.

@CherryPerry CherryPerry changed the title [WIP] Suspend children Suspend children Sep 7, 2022
Copy link
Collaborator

@KovalevAndrey KovalevAndrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update StatefulNode2's description. It currently says that Nodes are always alive. We can write something like "Node can be kept alive if you use KEEP mode"

core/src/main/kotlin/com/bumble/appyx/Appyx.kt Outdated Show resolved Hide resolved
core/src/main/kotlin/com/bumble/appyx/Appyx.kt Outdated Show resolved Hide resolved
is ChildEntry.Initialized ->
ChildEntry.Suspended(
key = key,
// TODO: Not able to get a scope from Compose here, providing fake one
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ticket? What's the impact?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on a client usage of SaverScope. We are providing SaverScope right now do be able to use canSave in code, but honestly I do not see any value in it right now because we are supporting Android only. Also not sure if anybody ever used canSave except Compose internals.

@CherryPerry CherryPerry merged commit e877ddc into main Sep 8, 2022
@CherryPerry CherryPerry deleted the suspend-children branch September 8, 2022 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BuildContext.savedStateMap memory leak Make logic of keeping off screen Nodes alive configurable
3 participants