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

Conversation

BruceMcRooster
Copy link
Contributor

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
Copy link
Member

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @BruceMcRooster!

@mbrandonw mbrandonw merged commit 47f753c into pointfreeco:main May 7, 2025
@BruceMcRooster BruceMcRooster deleted the stack-navigation-counterfeature-patch branch May 7, 2025 14:31
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.

2 participants