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

🐞: Throwing in updateState in init throws UnrecoverableException #121

Closed
2 of 9 tasks
Nek-12 opened this issue Dec 19, 2024 · 1 comment · Fixed by #123
Closed
2 of 9 tasks

🐞: Throwing in updateState in init throws UnrecoverableException #121

Nek-12 opened this issue Dec 19, 2024 · 1 comment · Fixed by #123
Assignees

Comments

@Nek-12
Copy link
Member

Nek-12 commented Dec 19, 2024

FlowMVI Version

3.2.0

Kotlin Version

N/A

Platforms

  • Android
  • iOS
  • macOS
  • Linux
  • Windows
  • JS
  • Wasm

Before you submit

  • I have read the FAQ and documentation
  • I have used search to find similar issues already reported

Issue details

Reproducer:

data class SampleState(
    val data: String = ""
) : MVIState

class SampleStore : Container<SampleState, Nothing, Nothing> {

    override val store: Store<SampleState, Nothing, Nothing> by lazyStore(SampleState()) {

        init {
            updateState {
                copy(
                    data = throw IllegalStateException("123")
                )
            }
        }

        recover {
            null
        }
    }

}

Looks like if the updateState tries to handle an exception in init, the handler is invoked two times, which causes it to think it's a resursive recover exception.

@Nek-12 Nek-12 added the triage Needs triaging label Dec 19, 2024
@Nek-12 Nek-12 self-assigned this Dec 19, 2024
@Nek-12 Nek-12 removed the triage Needs triaging label Dec 19, 2024
@Nek-12
Copy link
Member Author

Nek-12 commented Dec 19, 2024

Already fixed in 3.1.0-beta04

@Nek-12 Nek-12 closed this as completed Dec 19, 2024
@Nek-12 Nek-12 linked a pull request Dec 23, 2024 that will close this issue
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 a pull request may close this issue.

1 participant