question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.1.x Saved state handle suggestions

See original GitHub issue

Hi,

I’m implementing the new saved state handle in our MVI library sample and found the Koin API for handing saved state view models slightly too implicit.

Passing in a bundle like

private val viewModel by viewModel<TodoViewModel> { parametersOf(Bundle()) }

feels slightly too “magic” (pass in a bundle to make it work). In my case the view models would handle their own initial state, meaning I have to pass in an empty bundle every time. Looking at androidx.lifecycle.SavedStateHandle#createHandle null default state bundles are allowed though.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
arnaudgiulianicommented, Feb 5, 2020

just added the new API in alpha-11 … soon the beta 👍

0reactions
Rosomackcommented, Feb 12, 2020

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saved State module for ViewModel - Android Developers
As mentioned in Saving UI States, ViewModel objects can handle configuration changes, so you don't need to worry about state in rotations or...
Read more >
Koin sharedViewModel with SavedStateHandle - Stack Overflow
What if I want to have the model both shared and keep its state with SavedStateHandle? I cannot figure out if this is...
Read more >
Saving UI state with ViewModel SavedState and Dagger
The way it works is by passing a SavedStateHandle to the ViewModel's constructor, which you can then use to restore/save the state.
Read more >
Source Code for SavedStateHandle.java - AndroidX Tech
Set; /** * A handle to saved state passed down to {@link androidx.lifecycle. ... public final class SavedStateHandle { final Map<String, Object> mRegular; ......
Read more >
Delete Specific Application Saved States from Mac OS X ...
This tip will show you how to selectively remove saved app states for chosen applications. You can think of Resumes saved state files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found