Page MenuHomePhabricator

CodeMirror should not completely load when disabled in WikiEditor
Closed, ResolvedPublic3 Estimated Story Points

Description

It seems as if CodeMirror is always completely loaded when WikiEditor is enabled.

This seems suboptimal. Even when CodeMirror is disabled, all it's resources are still download and in memory. That is excessive. Instead:

1: Turn ext.CodeMirror into a 'loader script' with minimal dependencies
2: Create a new submodule like "ext.CodeMirror.dependencies"
3: Move as many dependencies of ext.CodeMirror into this new module.
4: Conditionally load those modules from the enableCodeMirror function
4: IF the logged in user has the preference option enabled, use addModules to preload/predeliver the modules in question

It also seems as if this module is depending on ooui-widgets for no particular reason (wiki editor provides the ooui icon intergration, so there is no need for this module to depend on ooui)....

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Niharika moved this task from New & TBD Tickets to Needs Discussion on the Community-Tech board.
Niharika subscribed.

Thanks for bringing this to our attention, @TheDJ.

Niharika added a subscriber: Mooeypoo.

@Mooeypoo Flagging this ticket for you. It doesn't require product consultation so I'm putting this in the Engineering backlog column. Please take some time to go over this ticket and other tickets in this column and prioritize and estimate them as needed.

Niharika set the point value for this task to 3.Nov 28 2018, 12:10 AM
Niharika moved this task from Needs Discussion to Up Next on the Community-Tech board.

I would like to, responding to this task, write a separate task requesting a preferential option to disable/opt-out the puzzle (CodeMirror) icon, which would also prevent loading the feature. But then I figure that I would like to request it here first instead. It's almost similar to opt-in/opt-out function of the Beta Feature version of the CodeMirror feature, but it's not Beta.

I would like to, responding to this task, write a separate task requesting a preferential option to disable/opt-out the puzzle (CodeMirror) icon, which would also prevent loading the feature. But then I figure that I would like to request it here first instead. It's almost similar to opt-in/opt-out function of the Beta Feature version of the CodeMirror feature, but it's not Beta.

@gh87 There are already way too many preferences, filling up Special:Preferences. We've been asked to restrict preferences for features that absolutely need it. This task already prevents loading the JavaScript for CodeMirror. Having another preference to remove the icon is not going to be very useful.

Change 495455 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/CodeMirror@master] Conditionally load syntaxhighlighting lib

https://gerrit.wikimedia.org/r/495455

Change 495455 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Conditionally load CodeMirror lib

https://gerrit.wikimedia.org/r/495455

TheDJ claimed this task.
TheDJ removed a project: Patch-For-Review.
TheDJ moved this task from Backlog to Done on the MediaWiki-extensions-CodeMirror board.