Skip to content

Instantly share code, notes, and snippets.

View valscion's full-sized avatar
🧸
On parental leave

Vesa Laakso valscion

🧸
On parental leave
View GitHub Profile
@valscion
valscion / machine.js
Created November 7, 2019 15:28
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => {
if (event.type !== 'SEARCH_REQUEST_SUCCESS') {
throw new Error(
`Unexpected event type for handleRequestSuccess: "${event.type}"`
);
}
return event.results;
},
@valscion
valscion / machine.js
Last active November 5, 2019 14:15
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => {
if (event.type !== 'SEARCH_REQUEST_SUCCESS') {
throw new Error(
`Unexpected event type for handleRequestSuccess: "${event.type}"`
);
}
return event.results;
},
pagination: (_ctx, event) => {
@valscion
valscion / machine.js
Created November 1, 2019 12:26
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results,
pagination: (_ctx, event) => event.pagination
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
pagination: null,
@valscion
valscion / machine.js
Created November 1, 2019 12:24
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results,
pagination: (_ctx, event) => event.pagination
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
@valscion
valscion / machine.js
Created September 30, 2019 13:38
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Last active September 30, 2019 13:28
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Created September 30, 2019 07:57
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Created September 27, 2019 15:00
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Created September 26, 2019 07:59
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Last active September 25, 2019 07:13
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []