Page MenuHomePhabricator

[MEX] Extract some sub-components
Closed, ResolvedPublic

Description

Use T396445: [MEX] Server-side rendering for sub-components to split the current wikibase.mobileUi.statementView.vue into several components.

Event Timeline

Lucas_Werkmeister_WMDE renamed this task from Extract some sub-components to [MEX] Extract some sub-components.
Lucas_Werkmeister_WMDE claimed this task.

Change #1160069 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Extract first subcomponent for mobile editing experience

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

There are some worrying test failures on the above patch, which start with:

[Vue warn]: Component is missing template or render function:  {                                                                                                                                                                                                                                                                                                                        
  name: 'WikibaseMexPropertyName',                                                                                                                                                                                                                                                                                                                                                      
  props: {                                                                                                                                                                                                                                                                                                                                                                              
    url: { type: [Function: String], required: true },                                                                                                                                                                                                                                                                                                                                  
    label: { type: [Function: String], required: true }                                                                                                                                                                                                                                                                                                                                 
  }                                                                                                                                                                                                                                                                                                                                                                                     
}                                                                                                                                                                                                                                                                                                                                                                                       
  at <WikibaseMexPropertyName url="mock-property-url" label="P1" >                                                                                                                                                                                                                                                                                                                      
  at <WikibaseMexStatement statement= {                                                                                                                                                                                                                                                                                                                                                 
  mainsnak: {                                                                                                                                                                                                                                                                                                                                                                           
    snaktype: 'value',
    property: 'P1',
    hash: 'ee6053a6982690ba0f5227d587394d9111eea401',
    datavalue: { value: 'p1', type: 'string' },
    datatype: 'string'
  },
  type: 'statement',
  id: 'Q1$eb7fdbb4-45d1-f59d-bb3b-013935de1085',
  rank: 'normal'
} ref="VTU_COMPONENT" >

(And then some assertion failures because the contents of the component are missing.) I think Jest isn’t loading the SFC file properly, so the component ends up without its template?

Apparently the solution for our “Component is missing template or render function” error is:

diff --git i/repo/resources/wikibase.mobileUi/wikibase.mobileUi.propertyName.vue w/repo/resources/wikibase.mobileUi/wikibase.mobileUi.propertyName.vue
index 649087ff4a..d101fc08e1 100644
--- i/repo/resources/wikibase.mobileUi/wikibase.mobileUi.propertyName.vue
+++ w/repo/resources/wikibase.mobileUi/wikibase.mobileUi.propertyName.vue
@@ -8,7 +8,7 @@
 const { defineComponent } = require( 'vue' );
 
 // @vue/component
-module.exports = defineComponent( {
+module.exports = exports = defineComponent( {
     name: 'WikibaseMexPropertyName',
     props: {
         url: {

I don’t understand it at all, but okay. (wikibase.mobileUi.statementView.vue and ScopedTypeaheadSearch.vue have the same thing already.)

Change #1160069 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Extract first subcomponent for mobile editing experience

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