Page MenuHomePhabricator

Make CategoryTabs a dumb component
Open, LowPublic

Description

Precursors: T173534, T215972

CategoryTabs has a method _loadCategories that is executed inside its render method ( inside postRender)
This makes an API request and updates the category overlay with the result.

Now we have the PromisedView component, we can move this behaviour out of the CategoryTabs component and into the categoryOverlay factory function.

CategoryTabs also makes use of a scrollEndEventEmitter that fetches new categories as the list of categories is scrolled. This behaviour should also be pulled out of the CategoryTabs component (and possibly the ScrollEndEventEmitter to - that is left to the implementor).

These 2 changes should make the CategoryTabs a dumb component and possibly allow it to be generalised into a Tabs component.

Acceptance criteria

  • CategoryTabs does not need to be passed an api option/prop
  • The following line is no longer inside the CategoryTab component:
	this.scrollEndEventEmitter.on( ScrollEndEventEmitter.EVENT_SCROLL_END,
		this._loadCategories.bind( this ) );

Developer notes

Check out https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/471335/ for an early attempt at doing this.