Skip to content

Change Counter to CounterFeature in StackBasedNavigation docs #3670

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BruceMcRooster
Copy link

I believe this was just a small typo, but I may be mistaken.
The example code in StackBasedNavigation.md referred to a Counter type, which I think was supposed to be the CounterFeature type created in the previous code block.


The reducer CounterFeature was declared

@Reducer
struct CounterFeature {
  // ...
}

and the main Feature was supposed to contain it in a StackState, to show testing stack-based navigation.

@Reducer
struct Feature {
  @ObservableState
  struct State: Equatable {
    var path = StackState<Path.State>()
  }
  enum Action {
    case path(StackActionOf<Path>)
  }

  @Reducer  
  struct Path {
    enum State: Equatable { case counter(Counter.State) }
    enum Action { case counter(Counter.Action) }
    var body: some ReducerOf<Self> {
      Scope(state: \.counter, action: \.counter) { Counter() }
    }
  }

  // ...
}

However, the Counter type referenced was not declared anywhere else, and the future examples of testing construct the Path using a CounterFeature.

@Test
func dismissal() {
  let store = TestStore(
    initialState: Feature.State(
      path: StackState([
        CounterFeature.State(count: 3)
      ])
    )
  ) {
    CounterFeature()
  }
}

Afaict this was just a typo, and the example code was referring to Counter where it should have referred to CounterFeature
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.

1 participant