Skip to content

Instantly share code, notes, and snippets.

@beresmate
Created April 27, 2021 17:42
Show Gist options
  • Save beresmate/c25416ddd912b310b81978731117c90e to your computer and use it in GitHub Desktop.
Save beresmate/c25416ddd912b310b81978731117c90e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const mhrMachine = Machine({
id: 'mhrMachine',
initial: 'metaData',
states: {
metaData: {
initial: 'empty',
states: {
empty: {
on: {
METADATA_CACHE_REUSED: 'populated',
METADATA_LOADING: 'loading'
}
},
loading: {
on: {
METADATA_LOAD_SUCCESS: 'populated',
METADATA_LOAD_FAILED: 'failed'
}
},
failed: {},
populated: {
initial: 'searchParams',
states: {
searchParams: {
initial: 'empty',
states: {
empty: {
on: {
SEARCHPARAMS_ADDED: 'populated'
}
},
populated: {
initial: 'unknown',
states: {
unknown: {
on: {
SEARCHPARAMS_VALIDATION_PASSED: 'valid',
SEARCHPARAMS_VALIDATION_FAILED: 'invalid'
}
},
valid: {
initial: 'referenceData',
states: {
referenceData: {
initial: 'empty',
states: {
empty: {
on: {
REFERENCE_DATA_LOADING: 'loading'
}
},
loading: {
on: {
REFERENCE_DATA_LOADED: 'populated',
REFERENCE_DATA_LOADING_FAILED: 'failed'
}
},
failed: {},
populated: {
on: {
REFERENCE_DATA_LOADING: 'loading'
}
}
}
}
}
},
invalid: {}
}
}
}
}
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment