Skip to content
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

fix: remove DispatchAction and unnecessary closures #252

Merged
merged 2 commits into from
Sep 1, 2019

Conversation

arturovt
Copy link
Member

@arturovt arturovt commented Sep 1, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[] Bugfix
[ ] Feature
[x] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@arturovt arturovt merged commit efdc606 into master Sep 1, 2019
@arturovt arturovt deleted the fix/closure-and-action branch September 1, 2019 17:58
@pdemilly
Copy link

pdemilly commented Sep 3, 2019

How do you now return an action which returns nothing. In some places in my code I have this. I guess I could replace with a dummy action

@Dispatch()
sometimesDo (aValue: boolean) => aValue ? new DoAnActionForVallue(aValue) : new DispatchAction(null)

@arturovt
Copy link
Member Author

arturovt commented Sep 3, 2019

How do you now return an action which returns nothing. In some places in my code I have this. I guess I could replace with a dummy action

@Dispatch()
sometimesDo (aValue: boolean) => aValue ? new DoAnActionForVallue(aValue) : new DispatchAction(null)

I wasn't sure that DispatchAction is used by someone, as it wasn't documented. This had to be a private API and I cannot remember why it was exposed as it was 1 year ago. If 2.1.0 is a breaking change for you then just downgrade to the 2.0.0.

DispatchAction is basically useless in the core of this plugin and I wouldn't recommend you using it either.

If the DispatchAction is used in many places you could just do the following:

declare interface Window {
  DummyAction: typeof DummyAction;
}

class DummyAction {
  static readonly type = null;
}

window.DummyAction = DummyAction;

Then click search + replace in your IDE and replace new DispatchAction(null) with new window.DummyAction().

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