Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

feat: add fixer for no-dispatch-in-effects #73

Conversation

rafaelss95
Copy link
Collaborator

I went with a suggest instead of fix in this case because although it does not produce invalid code, it can cause some unexpected behavior if for example someone sets dispatch: false and still calls store$.dispatch manually (as in the test), there may be breaks in the expected flow.

Copy link
Owner

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

I don't think we can fix this automatically, the test only has a simple case but the store.dispatch could be nested, or it could even be called multiple times.

@rafaelss95
Copy link
Collaborator Author

Yep, that's why I implemented it as a suggestion. I find suggestions really useful, because you hover to see the problem and check if the suggestion solves the problem properly at the same time. Let me know your thoughts on this.

@timdeschryver
Copy link
Owner

I'm going to think on this a while longer.
While I see why we want to do it, I'm worried peoples will just use the suggestion and expect things to work.

@DaSchTour
Copy link

I suspect, that in many cases people use dispatch inside an effect in very complex cases. For example as part of a longer procedure in the middle of the pipe and not at the end. So in many cases this probably will lead to errors.
Just my two cents.

@timdeschryver
Copy link
Owner

I'm going to close this, since I'm still not convinced.
Thanks for the effort you've put int this @rafaelss95

@rafaelss95
Copy link
Collaborator Author

No problem, Tim! To be honest, I no longer remembered that this PR was still open 😄

@rafaelss95 rafaelss95 deleted the feat/no-dispatch-in-effects-fixer branch July 12, 2021 19:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants