-
Notifications
You must be signed in to change notification settings - Fork 116
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
feat(annotations): Handle annotations staged change event #1247
Conversation
mxiao6
commented
Sep 3, 2020
•
edited
Loading
edited
- Annotations PR: feat(eventing): Emit new annotations_staged_change event box-annotations#570
- Unit tests
099951d
to
553ff81
Compare
89d0a72
to
4d0e9a6
Compare
4d0e9a6
to
8b266be
Compare
8b266be
to
7f8a098
Compare
Might be worth writing the unit tests for the fsm so that we can make sure all the transitions are covered even though this is just a draft right now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the type
still need to be passed into the transition
call here: 6118793#diff-c7f4ce178012f15dc209092ae0c317f9R1269?
@@ -33,7 +39,7 @@ export const stateModeMap = { | |||
export default class AnnotationControlsFSM { | |||
private currentState = AnnotationState.NONE; | |||
|
|||
public transition = (input: AnnotationInput, mode: AnnotationMode): AnnotationMode => { | |||
public transition = (input: AnnotationInput, mode: AnnotationMode = AnnotationMode.NONE): AnnotationMode => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having mode default to none
seems ripe for bugs to be introduced. Would it work if it was just optionally undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The state in FSM cannot be undefined
, so if mode is undefined
and state transition depends on mode, the state has to be none
which is the same as default mode to none
.
|
state: AnnotationState.NONE, | ||
input: AnnotationInput.CLICK, | ||
mode: AnnotationMode.HIGHLIGHT, | ||
nextState: AnnotationState.HIGHLIGHT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does nextState
and output
ever differ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextState
could be highlight_temp
and output is highlight
bd613d3
to
4828358
Compare