Page MenuHomePhabricator

Recommended reading exp: Create a Vue component for rendering recommendation results
Open, Stalled, MediumPublic

Description

Background

All paths, the main path – showing reading recommendations based on the interests a user selected during onboarding – and the fallback path of showing other recommended articles is described in T435522: Recommended reading exp: Show reading recommendations based on user-selected interests.

What (at best) exists at the implementation start of this task:

  • A placeholder ReadingRecommendations module from T436326: Recommended reading exp: Create and setup a placeholder component in newcomer home page (Gerrit 1332816): class ReadingRecommendations.
    • It provides both mount points: #reading-recommendations-vue-root (desktop, mobile details, overlay) and #reading-recommendations-vue-root--mobile (mobile summary tile).
    • The server-rendered "Personalize your daily reads" text inside the mount divs is the no-JS fallback.
  • A clear outline to start implementation of the recommendations (preferred at least the most important path – API for user-selected interest topics) T435522
  • The Impact module is the precedent for a Vue app inside a homepage module: Impact::getBody() renders an empty mount point <div id="impact-vue-root"> (mobile summary: #impact-vue-root--mobile) plus a no-JS fallback message. modules/ext.growthExperiments.Homepage.Impact/init.js then mounts the app with Vue.createMwApp(), reads the render mode from mw.config.get( 'homepagemodules' ).impact.renderMode (desktop, mobile-summary, mobile-overlay, mobile-details), and takes the data either from server-exported mw.config values or from a REST endpoint via the useMWRestApi composable.
  • Reusable pieces outside and already in the repo: CdxCard, to consider also modules/vue-components/ (CText, CList, CListItem, …). modules/vue-components/InterestSelector.vue already renders related articles as <cdx-card :force-thumbnail="true" :thumbnail="…">.
  • Per T435522: Recommended reading exp: Show reading recommendations based on user-selected interests a recommendation card must show: article image, article title, Wikidata description, and the interest label. There must be an empty state for articles without an image.
  • Nice to have: Thumbnails are bigger than in existing modules, per design.

Goal

Create the Vue component(s) that render the recommendation results inside the RecommendedArticles module, together with the wiring and the mount points, so that up to 4 recommendation cards are displayed on desktop and mobile Special:Homepage.

Scope is presentation only. The component takes the recommendations as props / injected data and renders them. Where the data actually comes from (interest matching, general-recommendation fallback, daily rotation) is T435522: Recommended reading exp: Show reading recommendations based on user-selected interests and its siblings. For this task, mock/fixture data is enough.

Open questions

  • ✔️ Own ResourceLoader module (ext.growthExperiments.Homepage.RecommendedArticles) with its own init.js, following the Impact pattern? And where do the files live — modules/ext.growthExperiments.Homepage.RecommendedArticles/? Already answered in own RL module ext.growthExperiments.Homepage.ReadingRecommendations in modules/ext.growthExperiments.Homepage.ReadingRecommendations/ => RL module ext.growthExperiments.Homepage.ReadingRecommendations in 'modules/ext.growthExperiments.Homepage.ReadingRecommendations/'
  • ✔️ Data delivery: server-exported. The module exports the day's recommendations through getJsData() into mw.config.get( 'homepagemodules' )[ 'reading-recommendations' ], and init.js reads them the way Impact's getServerExportedData() does.
  • ✔️ Does the module need server-rendered base markup and a no-JS fallback message, as Impact has, or is an empty mount point acceptable? => We chose this for availability with CirrusSearch and also for performance reasons.
  • ✔️ Loading state: Skeleton – to be released Skeleton component or vue-components/Skeleton.less https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/GrowthExperiments/+/master/modules/vue-components/Skeleton.less or even Codex PHP CdxCard? => The loading state is unreachable. Rows arrive with the page, so init.js never provides null, therefore we're not featuring a Skeleton loading for the chosen implementation path.
  • ✔️ Empty state for a missing image, current CdxCard handling ok – Just relying on empty fallback CSS without early thumbnail rendering otherwise there's a flash with CdxCard loading, will be follow-up patch to main patch
  • ✔️ The link to the interest picker (parent requirement 4) => Filed in separate T435525: Recommended reading exp: Show interaction element(s) to select interests on the reading module

Acceptance criteria for done

  • Vue component renders a list of up to 4 recommendation cards from provided data.
  • Each card shows thumbnail, title, Wikidata description and interest label. Missing image and missing description are handled gracefully, not broken layout.
  • Empty and error states are implemented.
  • Renders correctly on desktop and mobile,
    • in LTR and RTL
    • in dark mode
  • All user-facing strings internationalizable; messages documented in 'qqq.json'.
  • Jest unit test next to the component (repo convention: 'Component.test.js').

Event Timeline

Volker_E renamed this task from Create a Vue component for rendering recommendation results to Recommended reading exp: Create a Vue component for rendering recommendation results.Aug 28 2026, 11:38 PM
aude updated the task description. (Show Details)
aude lowered the priority of this task from High to Low.Sep 8 2026, 4:33 PM

Change #1339107 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/GrowthExperiments@master] feat(AccountSetup): Add 'link' icon to the related description fallback

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

Change #1339180 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/GrowthExperiments@master] [WIP] feat(AccountSetup): Render the recommendation cards in Vue

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

Change #1339107 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] feat(AccountSetup): Add 'link' icon to the related description fallback

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

Change #1340017 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/GrowthExperiments@master] feat(AccountSetup): Drop the no-JS thumbnail image from the card list

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

After some inputs from my colleagues Monday morning, we need to reconsider Vue usage of the cards output vs (only) server-side rendering already in place. Pros and cons collected below.

Vue renderer

Pros

  • [Medium] Correct Codex markup by construction. Real CdxCard/CdxThumbnail, so it gets cdx-card--title-only, the icon-based placeholder, and slot-driven omission of empty lines automatically. A Codex upgrade that restructures card internals will update this for free.
  • [Medium] It has an error state. ‘App.vue’ shows a CdxMessage when the export is missing, rather than a blank module. ==> Tackled in a separate patch for SSR.
  • [Medium] It enforces the display cap. ‘RecommendationList.vue’ slices to MAX_RECOMMENDATIONS.
  • [Medium] Good test coverage of the state matrix. ‘App.test.js’, ‘init.test.js’, and both component tests cover list/empty/error, both render modes, and the mount wiring.
  • [Open question, not yet a pro] Future in-module interactivity. The only justifying remainder. But the instrumentation deck assigns the interest picker to the Editor Growth team (p.3), and the designs on p.8/p.20 show the in-module affordance as a “Select interests” button – if that navigates to the picker, it’s an <a> and needs no Vue. Worth clarifying before more is built on this layer.

Cons

  • [High] It ignores the hasInterests it is given (also something also @LMora-WMF pointed out on the review). The mirror-image bug: an interests-having user with empty results is told on mount to pick interests they already picked.
  • [High] It contributes nothing to any of the five measurement needs. Referral rate is passive, mobile/desktop is known in PHP, retention needs no instrumentation, and a click event needs a delegated listener – not Vue.
  • [High] Instrumenting inside it would actively lose data. The server-rendered cards are clickable from first paint; the RL module is deferred. Clicks in that window are real – top of the homepage, first thing rendered – and a listener that only exists after app.mount() misses every one of them.
  • [High] It buys nothing today. No fetch, no interactivity, no state (values “settled once and for all at mount”). Only unique output is the error message.
  • [Medium] Its module config ships Codex CSS twice. Core’s CodexModule::addComponentFiles() adds component CSS to any non-codexScriptOnly module’s style payload, , so CdxCard (+CdxThumbnail) ship in the render-blocking .styles module and the deferred script module. ==> Possible Vue renderer fix: add CdxMessage to the styles module’s codexComponents, set "codexScriptOnly": true on the script module.
  • [Medium] Mounting re-paints the thumbnails. <Transition name="cdx-thumbnail__image"> fades in already-painted background images. ==> Vue renderer fix: in the follow-up patch already linked.
  • [Medium] Mounting can only downgrade what the server rendered. A non-array recommendations swaps a good list for an error message.
  • [Low] Duplicate payload. Rows serialized twice per view – HTML plus mw.config JSON.

Server-side renderer

Pros

  • [High] It is the complete product, and it matches the design. Everything works with no JS, slow JS, or a failed RL request — and for the no-interests state it renders what p.8 actually show.
  • [High] It delivers the primary metric on its own. Internal referral rate is passive: plain <a href>, browser sends Referrer: …/Special:Homepage. Same-origin navigation retains the full path under the modern browser default, and core’s $wgReferrerPolicy defaults to false.
  • [High] It is the correct surface to instrument. A delegated listener on the server-rendered <ul> captures clicks from first paint, including the pre-mount window the Vue path loses.
  • [High] Impressions and the mobile/desktop split are already server-side-solvable with existing machinery. SpecialHomepage generates a pageviewToken; SpecialHomepageLogger logs HomepageVisit in a DeferredUpdate with is_mobile and per-module state via $impactModule->getState(). Add the 4 pageIds tagged interest/generic the same way – no JS.
  • [Medium] Design-system alignment is good. Every class getListItemHtml() emits exists in ‘codex.style.css’, following the documented Codex CSS-only pattern via codexStyleOnly.
  • [Medium] Escaping is correct. CSSMin::buildUrlValue() for the thumbnail URL,.

Cons

  • [High] No error state. An empty service result for an interests-having user yields a silently empty mdule. >> To be fixed
  • [Medium] It can’t produce a click event by itself – so curiosity metric #3 (“REx has to instrument this”) either becomes an inferential join (impression event × webrequest, ambiguous and costly to re-run) or needs ?source= params on article URLs (precedent exists at SpecialHomepageLogger.php), but it mutates article URLs and will draw review pushback). A ~15-line delegated-listener module would close this gap without Vue.
  • [Medium] It mirrors Codex internals by hand. Reason for the next one, and of whatever the next Codex bump breaks.
  • [Medium] Missing cdx-card--title-only, so a title-only card re-aligns vertically (align-items: center).
  • [Medium] Every card change has to be made twice, with nothing enforcing agreement.
  • [Low] The fixture path bypasses the cap. SLOTS and MAX_RECOMMENDATIONS both equal 4, so production is unaffected.

Affects both

  • [Note] Coverage asymmetry to declare up front. Referral rate (#1) covers all users; any click-based CTR covers only JS-capable ones. Different denominators – fine, provided JS availability doesn’t differ by path.

With this, we are moving forward with the proposal

  • Go with the server-side-rendered, knowing that we have to manually align markup
  • Ensure that error handling is carried over to it
  • Apply forward-looking group cards design (see T436332) to SSR

Stalling this Vue rendered task. Keep the approach in the back of our hand for evaluating after a successful experiment.

Change #1340017 abandoned by VolkerE:

[mediawiki/extensions/GrowthExperiments@master] feat(AccountSetup): Drop the no-JS thumbnail image from the card list

Reason:

Just keeping predecessing patch I86c9a4112c7f8ed active for now.

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