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

some serious issue in viewModel #32

Open
razaghimahdi opened this issue Aug 11, 2021 · 1 comment
Open

some serious issue in viewModel #32

razaghimahdi opened this issue Aug 11, 2021 · 1 comment

Comments

@razaghimahdi
Copy link

so when i try to multi trigger events it doesnt work correctly, for example i was testing BlogViewModel in init method i called some onTriggerEvent on purpose, then i find out list sets empty, why this happened? what we should do to solve that?

@razaghimahdi
Copy link
Author

so finally after two days i think i got solution:
i tied to use old fashioned way

i deleted:

this.state.value = state.copy(
                        order = order,
                        filter = filter
                    )

and used this:

    fun getCurrentViewStateOrNew(): BlogState{
        val value = state.value?.let{
            it
        }?: BlogState()
        return value
    }

    fun setViewState(viewState: BlogState){
        state.value = viewState
    }

i have no idea why this works and why that one doesn't works,
any idea?

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

No branches or pull requests

1 participant