⚓ T354187 Creating a namespacesmultiselect field throws an error
Page MenuHomePhabricator

Creating a namespacesmultiselect field throws an error
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a MW HTMLForm with a "namespacesmultiselect" field

What happens?:

The field remains on its loading state instead of showing the data. A JS exception is thrown.

Screenshot 2024-01-02 at 14.17.30.png (298×1 px, 32 KB)

What should have happened instead?:
The field shows the data and allows to select more namespaces

Screenshot 2024-01-02 at 14.18.43.png (324×1 px, 35 KB)
Screenshot 2024-01-02 at 14.18.36.png (1×1 px, 115 KB)

Software version (skip for WMF-hosted wikis like Wikipedia):

Reproduced on a dev setup

Other information (browser name/version, screenshots, etc.):

TypeError: Cannot read properties of undefined (reading 'static')
    at new MwWidgetsNamespacesMultiselectWidget (mw.widgets.NamespacesMultiselectWidget.js:24:46)
    at OO.ui.Element.static.unsafeInfuse (oojs-ui-core.js:822:12)
    at deserialize (oojs-ui-core.js:799:36)
    at OO.copy (oojs.js:455:17)
    at OO.copy (oojs.js:482:27)
    at OO.ui.Element.static.unsafeInfuse (oojs-ui-core.js:795:12)
    at OO.ui.Element.static.infuse (oojs-ui-core.js:697:33)
    at OO.ui.infuse (oojs-ui-core.js:335:30)
    at HTMLDivElement.eval (autoinfuse.js:28:12)
    at Function.each (jquery.js:383:19)

Event Timeline

mw.widgets.NamespacesMultiselectWidget.js line 24 is:

			options = mw.widgets.NamespaceInputWidget.static.getNamespaceDropdownOptions( {} );

so this looks like a missing dependency from NamespacesMultiselectWidget to NamespaceInputWidget. It probably works in bigger forms because some other form field causes the necessary module to be loaded.

Change #1013513 had a related patch set uploaded (by Ammarpad; author: Ammarpad):

[mediawiki/core@master] resources: Add missing dependency for NamespacesMultiselectWidget

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

Change #1013513 merged by jenkins-bot:

[mediawiki/core@master] resources: Add missing dependency for NamespacesMultiselectWidget

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