-
Notifications
You must be signed in to change notification settings - Fork 277
Description
Description of the problem
The diff viewer with the original submission source fails to load due to duplicate Monaco models.
Your environment
- Branch
main
Steps to reproduce
- Submit
- As admin, edit the submission and resubmit it.
- As admin, edit the resubmission and resubmit it.
Expected behaviour
The submission source page shows the 2 diff viewers (comparing to previous and original) correctly.
Actual behaviour
Loading the Diff to original submission
viewer fails due to duplicate Monaco model definitions. The models are stored globally and we are using the same URI twice.
Uncaught Error: ModelService: Cannot add model because it already exists!
_createModelData http://localhost:12345/js/monaco/vs/editor/editor.main.js:692
createModel http://localhost:12345/js/monaco/vs/editor/editor.main.js:692
H http://localhost:12345/js/monaco/vs/editor/editor.main.js:739
q http://localhost:12345/js/monaco/vs/editor/editor.main.js:739
U http://localhost:12345/js/monaco/vs/editor/editor.main.js:739
<anonymous> http://localhost:12345/jury/submissions/102/source:306
_invokeFactory http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
complete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_onModuleComplete http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
_resolve http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
defineModule http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
i http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
d http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
o http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
y http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
E http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
k http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
d http://localhost:12345/js/monaco/vs/editor/editor.main.js:6
_loadPluginDependency http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
_resolve http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
defineModule http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:8
p http://localhost:12345/js/monaco/vs/loader.js?v=8.4.0DEV/2d6f4ff6a:9
define http://localhost:12345/js/monaco/vs/editor/editor.main.js:5
<anonymous> http://localhost:12345/js/monaco/vs/editor/editor.main.js:75
<anonymous> http://localhost:12345/js/monaco/vs/editor/editor.main.js:739
editor.main.js:692:3358
Possible fixes:
- Include the original AND modified IDs in the URL to make them unique.
- Properly share the models (as intended by Monaco) between the diff viewers.