uber / uber/RIBs

To keep the state in Presenter or Interactor for click events?

Open
#411 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Android
Dominant language
Kotlin
Stars
7.9k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

I'd prefer to keep things stateless if possible
A Stream is perfect for that but too much work
So keeping the state for click events
But can't make up my mind between the Interactor and the Presenter
Any recommendations?

A typical Interactor:

override fun didBecomeActive() {
        super.didBecomeActive()
        getDataAsync()
               .subscribe { theData ->
                       // to keep theData as state here or not?
                       presenter.present(theData) // or inside the Presenter? 🤔 
               }
}

// upon user click, we need to theData again
fun onClick(theData: TheDataType) {
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the Interactor entry points shown in the issue, including didBecomeActive(), getDataAsync(), and onClick(), alongside the Presenter call. Compare the two proposed state locations and the stateless Stream alternative; the issue is complete when the project has a decided, documented approach for handling click-event state.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.