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

TypedAction.create() deprecated in favor of defineAction() #35

Closed
crazytoucan opened this issue May 9, 2020 · 2 comments · Fixed by #52
Closed

TypedAction.create() deprecated in favor of defineAction() #35

crazytoucan opened this issue May 9, 2020 · 2 comments · Fixed by #52

Comments

@crazytoucan
Copy link
Contributor

As of Redoodle 2.5.0, the old TypedAction.create() is now deprecated in favor of its near-equivalent defineAction(). This change was done for a few reasons:

  • Fewer closures required per action definition, which ultimately speeds up boot cost of action definitions considerably.
  • Better tree-shaking in modern webpack toolchains

For consumers, the following migration guide should be helpful:

  1. All usages of TypedAction.define() and TypedAction.defineWithoutPayload() should be migrated to defineAction().
  2. All usages of FooTypedAction.create(...) and FooTypedAction.createWithMeta(...) should be migrated to FooDefinedAction(...).
  3. All usages of FooTypedAction.is(action) should be migrated to isType(action, FooDefinedAction.TYPE)

Any issues encountered during migration can be filed here or as a separate ticket.

@rhysbrettbowen
Copy link
Contributor

https://github.com/palantir/redoodle/blob/master/src/defineAction.ts#L49 Looking at this line - shouldn't it be arguments === 2 ? as the metadata would be the second argument

@crazytoucan
Copy link
Contributor Author

Good catch! Apologies for the issue -- #52

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 a pull request may close this issue.

2 participants