feat: working react page with implementation of _render_react_page #1991
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR - React on ORA
What work?
npm run start
hot reload the change (still need to refresh the page manually)npm run build
with production buildlms
andstudio
What not work?
paragon
styling mostly it got override fromlms-course
andlms-main
which came fromedx-platform
. I don't expect to use it in a long while.OpenAssessmentBlock
specifically. Once we rewrite it, it should be faster.What changed?
openassessment/xblock/openassessmentblock.py:: _render_react_page
that we will use to render react page.page_name
,props
,on_mount_func
page_name
the react component/page.jsx
that should locate inopenassessment/xblock/static/js/src/react/
. All of the.jsx
file that create here will be parse accordingly.props
are the property that will show up in the react component. We definitely need some clean up about how to lint props type later. Right now it is arbitrary.on_mount_func
this is require at the moment because I am trying to piggy back on the existing behavior. Once we reimplement everything, we won't need to use this anymore.How it work?
return self._render_react_page('oa_base', context_dict, on_mount_func='OpenAssessmentBlock')
openassessment/templates/openassessmentblock/react_template.html
as the template.openassessment/xblock/static/js/src/react_base.js
as default javascript file.RenderReact
will import pageopenassessment/xblock/static/js/src/react/oa_base.jsx
dynamically and render it. (if you lookopenassessment/xblock/static/js/src/react/oa_base.jsx
andopenassessment/templates/openassessmentblock/oa_base.html
, the file should be almost identical. This will make updating the existing pattern much faster)RenderReact
will parse the props correctly willonMount
function to run inuseEffect
. We need this right now becauseOpenAssessmentBlock
is quite complex to rewrite with limited time. But it should be possible in the future.Reason
openassessment/xblock/static/js/src/react/
because I want to make sure future implementation of react will be simple. No need to worry about intl provider or reactdom rendering.Future?
.html
to.jsx
Component
vsPage
or just all the same. Do we need more entries point than justreact_render
lms
andstudio
that propagate to xblock and overwrite paragon?