Skip to content

Duplicated/invalid actions are received when tab view appear #2

@darrarski

Description

@darrarski

Description

Reported by @saroar in a comment to another issue.

Steps to reproduce

  1. Add onAppear actions to each component.
  2. Send the onAppear action to the ViewStore inside .onAppear(perform:) modifier in each view.
  3. In each of the reducers, just return .none effect when onAppear action is received.
  4. Run the app and randomly switch tabs.

Expected behavior

  1. Whenever tab is switched, onAppear action of the currently selected tab's component should be received.

Actual behavior

  1. Sometimes wrong onAppear action is received, for example when switching from "Color" to "Shape" tab, instead of single ShapeAction.onAppear, two actions are received: ShapeAction.onAppear and then PreviewAction.onAppear.

Testing notes

The issue occurs only when action is sent to the ViewStore in .onAppear(perform:) modifier. When not sending the action in the closure (but for example just printing something to the console) - everything is working as expected.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions