Skip to content

Commit 7c9711b

Browse files
refactor(overmind): change from mutate to mutation as operator name
1 parent e63d360 commit 7c9711b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/demos/todomvc/src/app/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { Action } from './'
44
export default (action: Action) => ({
55
changeNewTodoTitle: action<React.ChangeEvent<HTMLInputElement>>()
66
.map((event) => event.currentTarget.value)
7-
.mutate((state, value) => (state.newTodoTitle = value)),
7+
.mutation((state, value) => (state.newTodoTitle = value)),
88
})

packages/node_modules/overmind-devtools/src/client/app/actions.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Action, Context } from './'
2-
import { State, Apps, AppMessage, Message } from './state'
2+
import { State, Apps, Message } from './state'
33

44
/*
55
TASKS
@@ -63,25 +63,25 @@ const addMessageFromClient = (state: State, message: Message) => {
6363
*/
6464

6565
export default (action: Action) => {
66-
const onMessage = action<any>().mutate(addMessageFromClient)
66+
const onMessage = action<any>().mutation(addMessageFromClient)
6767

6868
return {
6969
loadDevtools: action()
7070
.map(getAppsFromStorage)
71-
.mutate(setApps)
71+
.mutation(setApps)
7272
.map(getCurrentPortFromStorage)
73-
.mutate(setCurrentPort)
74-
.mutate(setAppLoaded)
73+
.mutation(setCurrentPort)
74+
.mutation(setAppLoaded)
7575
.map(connectCurrentPort(onMessage)),
76-
setError: action<string>().mutate(setError),
76+
setError: action<string>().mutation(setError),
7777
changeNewPortValue: action<string>()
7878
.map(toNumber)
79-
.mutate(setNewPortValue),
79+
.mutation(setNewPortValue),
8080
addPort: action()
8181
.map(getNewPortFromState)
82-
.mutate(setCurrentPort)
83-
.mutate(addNewApp)
84-
.mutate(resetNewPortValue)
82+
.mutation(setCurrentPort)
83+
.mutation(addNewApp)
84+
.mutation(resetNewPortValue)
8585
.do(storeApps),
8686
openApp: action<string>(),
8787
}

packages/node_modules/overmind/src/createActionFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type OperatorCallback<Context, Value, NewValue = Value> = (
1313
) => NewValue | Promise<NewValue>
1414

1515
interface Operators<State, Context, InitialValue, Value> {
16-
mutate(
16+
mutation(
1717
cb: (state: State, value: Value) => any
1818
): InitialValue extends undefined
1919
? NoValueAction<State, Context, InitialValue, Value>
@@ -99,7 +99,7 @@ export default function createActionFactory<State, Context>(proxyStateTree) {
9999
runOperators
100100
) as any,
101101
{
102-
mutate(cb: (state: State, value: Value) => any) {
102+
mutation(cb: (state: State, value: Value) => any) {
103103
const operator = (value, context) => {
104104
proxyStateTree.startMutationTracking()
105105
cb(context.state, value)

packages/node_modules/overmind/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('OPERATORS', () => {
5454
foo: 'bar',
5555
},
5656
actions: (action) => ({
57-
doThis: action().mutate((state) => (state.foo = 'bar2')),
57+
doThis: action().mutation((state) => (state.foo = 'bar2')),
5858
}),
5959
})
6060

0 commit comments

Comments
 (0)