-
Notifications
You must be signed in to change notification settings - Fork 172
Use context properties instead of state #191
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
Conversation
And also one container
Note that as of now, playground chapter switching works.
to AssessmentWorkspace
- Moved state props - Moved dispatch props (and import references)
Pull Request Test Coverage Report for Build 283
💛 - Coveralls |
As of now, interruption of runtime works, but the stop button does not get reset. I suspect that this is because of the order of calling between saga vs the reducers.
This will allow for 2 calls -- one for the interpreter to actually stop the program and one to call after interruption, to cause UI changes
src/reducers/workspaces.ts
Outdated
...state[location], | ||
isRunning: false | ||
} | ||
...state |
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.
As discussed, there is a chance that this fails due to its async nature.
interrupt(context) in the saga inserts an interrupt error into the context. The scheduler only stops on the next evaluation step when it comes across this interrupt error. Then, the scheduler stops execution and sets context.isRunning to false. END_INTERRUPT_EXECUTION depends on the scheduler having done all this before the reducer takes this action of recreating the state, so that the props has a new value for isRunning and therefore triggers a re-render of the eval/run/stop buttons.
Instead, make END_INTERRUPT_EXECUTION explicitly (and redundantly) set isRunning in the context to false, and also push an interrupt error into the context (reference).
src/actions/actionTypes.ts
Outdated
* Called to signal the end of an interruption, | ||
* i.e called after the interpreter is told to stop interruption, | ||
* to cause UI changes. | ||
*/ |
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.
Can we move these comments to the reducers? I think there are at least three places we can comment on the actions:
- actionTypes
- actionCreators
- reducers & saga
And I think we should standardise them being in the reducers and saga because
- Most of them are already there, and
- That's where the logic is
Thanks, changes made 😄 |
Features
sourceChapter
property in the stateisRunning
Issues fixed
Fixes #39
Directly following