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

[v5] Actions refactor #2484

Merged
merged 76 commits into from
Nov 12, 2021
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
1a943a2
Add resolvedAction
davidkpiano Jul 25, 2021
f98be55
Fix React asEffect etc. tests
davidkpiano Jul 25, 2021
aaf7c05
Fix types
davidkpiano Jul 25, 2021
ddd3b15
More descriptive name (TBD)
davidkpiano Jul 25, 2021
dfbbd98
Simplify actions.cancel(...)
davidkpiano Jul 25, 2021
19fa8d4
WIP
davidkpiano Jul 28, 2021
695771e
Remove gnarly switch statement
davidkpiano Jul 28, 2021
8f74d2e
Testing with dynamic log action
davidkpiano Jul 30, 2021
c730d54
Add DynamicAction
davidkpiano Jul 30, 2021
3810f48
Start separating actions
davidkpiano Jul 30, 2021
5f1ced3
Make send dynamic
davidkpiano Jul 30, 2021
3a20f96
Organize send actions
davidkpiano Jul 30, 2021
5047785
Fix tests
davidkpiano Jul 31, 2021
ac615a6
Fix xstate-scxml
davidkpiano Jul 31, 2021
b450bf2
Refactor DynamicAction
davidkpiano Jul 31, 2021
42b74e5
Merge branch 'next' into v5/actions-refactor
davidkpiano Jul 31, 2021
62e2ec4
WIP
davidkpiano Aug 1, 2021
dd486cc
Pure action object
davidkpiano Aug 1, 2021
a052110
getActionFunction refactor
davidkpiano Aug 1, 2021
d40f264
Assign WIP
davidkpiano Aug 1, 2021
16ff3da
WIP fixing tests
davidkpiano Aug 1, 2021
ac28699
Fix SCXML tests
davidkpiano Aug 1, 2021
1abad8d
Fix types
davidkpiano Aug 1, 2021
983e8d5
Update snapshots
davidkpiano Aug 3, 2021
7ce4b0e
Renaming
davidkpiano Aug 8, 2021
a04e5ff
Rename + refactor
davidkpiano Aug 8, 2021
57f32d5
Remove toString
davidkpiano Aug 8, 2021
a4e9c02
Add resolveActionObject
davidkpiano Aug 8, 2021
586d4f4
Remove dead code
davidkpiano Aug 8, 2021
874670f
Attempt to fix types
davidkpiano Aug 9, 2021
7b9e10d
Fix type import
davidkpiano Aug 9, 2021
c219768
Update snapshots
davidkpiano Aug 9, 2021
18ff482
Merge branch 'main' into v5/actions-refactor
davidkpiano Sep 10, 2021
559a803
Merge branch 'main' into v5/actions-refactor
davidkpiano Sep 15, 2021
792d342
Merge branch 'next' into v5/actions-refactor
davidkpiano Sep 16, 2021
7d9bdd7
Fix assign error issue!
davidkpiano Sep 16, 2021
894cf15
Cleanup
davidkpiano Sep 16, 2021
45c3455
Merge branch 'next' into v5/actions-refactor
davidkpiano Sep 18, 2021
ee45ae8
Simplify types (WIP)
davidkpiano Sep 18, 2021
95c62fe
Begin adding type tests
davidkpiano Sep 18, 2021
c686ca0
Merge branch 'next' into v5/actions-refactor
davidkpiano Oct 2, 2021
1ea4b67
Cleaning up types
davidkpiano Oct 4, 2021
a656204
Improve tests + organization
davidkpiano Oct 4, 2021
df48d22
Update packages/core/test/state.test.ts
davidkpiano Oct 7, 2021
21a4546
Add todo
davidkpiano Oct 7, 2021
b94272b
Merge branch 'v5/actions-refactor' of https://github.com/davidkpiano/…
davidkpiano Oct 7, 2021
4255448
Update packages/core/package.json
davidkpiano Oct 13, 2021
ed57eb1
Update packages/core/actions/ExecutableAction.ts
davidkpiano Oct 13, 2021
380e133
Update packages/core/src/actions/log.ts
davidkpiano Oct 13, 2021
6e80a77
Update packages/core/src/actions/stop.ts
davidkpiano Oct 13, 2021
8c723c7
Update packages/core/src/types.ts
davidkpiano Oct 13, 2021
5e33849
Merge branch 'next' into v5/actions-refactor
davidkpiano Oct 17, 2021
8dfbafe
Merge branch 'next' into v5/actions-refactor
davidkpiano Nov 6, 2021
18e2f8d
Addressing comments
davidkpiano Nov 7, 2021
9421083
MachineNode -> StateMachine
davidkpiano Nov 7, 2021
6e0c447
StaticChooseAction -> ResolvedChooseAction & other tweaks
davidkpiano Nov 7, 2021
8d913dc
Making TS a little happier
davidkpiano Nov 7, 2021
84c1576
Making TypeScript less upset at me
davidkpiano Nov 7, 2021
f1330f5
Ignore asEffect/asLayoutEffect TS errors
davidkpiano Nov 8, 2021
71caef5
Add comment for SCXML error handling
davidkpiano Nov 8, 2021
a5576ca
Simplify BaseAction
davidkpiano Nov 8, 2021
1b331f9
Add BaseActions to TransitionConfig
davidkpiano Nov 8, 2021
58c36d1
Activity -> actor
davidkpiano Nov 8, 2021
ca1b8d7
Remove useScheduleEffect
davidkpiano Nov 8, 2021
08170d2
Rename state name in test
davidkpiano Nov 8, 2021
64b3c05
Cleanup
davidkpiano Nov 11, 2021
54a17e7
Remove comment
davidkpiano Nov 11, 2021
5e7d5ee
Remove updateContext.ts and resolve original assign action
davidkpiano Nov 11, 2021
a2b5044
Remove redundant code in interpreter
davidkpiano Nov 11, 2021
efb216f
Add `isExecutableAction`
davidkpiano Nov 12, 2021
c0ecbbd
Refactor resolveActionObject in toActionObject
davidkpiano Nov 12, 2021
7521b5e
Refactor dynamicAction to object
davidkpiano Nov 12, 2021
8d3d8d3
Fix send typings
davidkpiano Nov 12, 2021
4a0cb76
Rename
davidkpiano Nov 12, 2021
115d77e
Add todo
davidkpiano Nov 12, 2021
0b49437
Add changeset
davidkpiano Nov 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix xstate-scxml
davidkpiano committed Jul 31, 2021
commit ac615a6b6af637104e33b9e6192622d154360ab7
25 changes: 12 additions & 13 deletions packages/xstate-scxml/src/index.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import {
MachineNode,
flatten
} from 'xstate';
import { RaiseActionObject } from 'xstate';

function cleanAttributes(attributes: Attributes): Attributes {
for (const key of Object.keys(attributes)) {
@@ -23,21 +24,19 @@ export function functionToExpr(fn: Function): string {
return fn.toString();
}

function actionToSCXML(action: ActionObject<any, any>): XMLElement {
const { type, params: attributes } = action;

const actionTypeMap: Record<ActionType, string> = {
'xstate.raise': 'raise'
function raiseActionToSCXML(raiseAction: RaiseActionObject<any>): XMLElement {
return {
type: 'element',
name: 'raise',
attributes: {
event: raiseAction.params._event.name
}
};
}

const name = actionTypeMap[type];

if (name) {
return {
type: 'element',
name,
attributes
};
function actionToSCXML(action: ActionObject<any, any>): XMLElement {
if (action.type === 'xstate.raise') {
return raiseActionToSCXML(action as RaiseActionObject<any>);
}

return {