Page MenuHomePhabricator

Parse API does not return category-triggered gadgets
Open, Needs TriagePublicBUG REPORT

Description

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

What happens?:
The calculator does not appear.

What should have happened instead?:
The calculator appears, just as in non-live preview.

Other information (browser name/version, screenshots, etc.):
The parse API should return ext.gadget.Calculator as one of the modules.

Event Timeline

Ammarpad moved this task from Backlog to Live preview on the MediaWiki-Page-editing board.

The parse API should return ext.gadget.Calculator as one of the modules.

I believe the problem is the module presence (to be eligible for return) is dependent on category existence, but the category existence check has already happened on the first server loading of the edit page which is the only load for live preview. You can request the parsing API to return the categories of the page blindly, but then you really have to parse that info (maybe in MediaWiki-extensions-Gadgets) and dynamically load the module if it qualifies.

the category existence check has already happened on the first server loading of the edit page which is the only load for live preview

That would not be a problem. Live preview already asks for the categories as well as modules, which means the parse API is already capable of dynamically generating categories from a source. So it should just return the gadget as one of the modules if the triggering category is present in the parsed result.

The gadget in the example uses the wikipage.content hook so it loading only once is not a problem.