Page MenuHomePhabricator

Fix block message drawer storybook component in MobileFrontend
Closed, ResolvedPublic2 Estimated Story Points

Description

The blockMessageDrawer storybook component appears to have been broken by this change: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/625899/

The storybook error is here: https://doc.wikimedia.org/MobileFrontend/master/js/ui/?path=/story/drawer--blockmessagedrawer-unknown-user

TypeError: Cannot read property 'then' of undefined
    at BlockMessageDetails.value (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:172623)
    at BlockMessageDetails.render (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:34496)
    at BlockMessageDetails._postInitialize (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:34112)
    at BlockMessageDetails.initialize (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:33871)
    at BlockMessageDetails.View (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:33303)
    at new BlockMessageDetails (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:170866)
    at module.exports (https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:27392)
    at https://doc.wikimedia.org/MobileFrontend/master/js/ui/main.bd1690fe1ac55b9dc65d.bundle.js:1:167874
    at https://doc.wikimedia.org/MobileFrontend/master/js/ui/vendors~main.bd1690fe1ac55b9dc65d.bundle.js:74:151174
    at withSubscriptionTracking (https://doc.wikimedia.org/MobileFrontend/master/js/ui/vendors~main.bd1690fe1ac55b9dc65d.bundle.js:74:151949)

Event Timeline

Niharika triaged this task as Medium priority.Feb 24 2021, 5:57 PM
Niharika set the point value for this task to 2.

Change 668441 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/MobileFrontend@master] Drawer.stories.js: Set parsedReason on blockMessageDrawer config

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

@STran @DLynch - To test this, you can run npm run build-storybook and npm run storybook locally. The three block message drawer components that were broken should not throw an error any more.


Once it was working I noticed a separate (existing) bug with the message expecting a gender, but we can ignore it for the purposes of this task:

@Jdlrobson I had a look at fixing this by overriding global.mw.user.options.get in storybook/config.js but it didn't seem to work. Is this worth filing as a bug?

@Tchanders the mock mediawiki should have that - https://github.com/wikimedia/mw-node-qunit/blob/master/src/mockMediaWiki.js#L87 but it will always return undefined. The components should be agnostic to mw.config. It helps make them reuable (we're planning to move these to wvui eventually where there is no mw object.)

gender should be an explicit parameter passed to the component, not read directly from mw.user.options.

@Tchanders the mock mediawiki should have that - https://github.com/wikimedia/mw-node-qunit/blob/master/src/mockMediaWiki.js#L87 but it will always return undefined. The components should be agnostic to mw.config. It helps make them reuable (we're planning to move these to wvui eventually where there is no mw object.)

gender should be an explicit parameter passed to the component, not read directly from mw.user.options.

Thanks @Jdlrobson, I've filed T276490 about this

Change 668441 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Drawer.stories.js: Set parsedReason on blockMessageDrawer config

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

Error is no longer appearing at the link from the task description (nor for the other block drawer components).