File tree Expand file tree Collapse file tree
testgen/ui/components/frontend/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,11 +50,7 @@ const componentLoaders = {
5050} ;
5151
5252const TestGenComponent = async ( /** @type {string } */ id , /** @type {object } */ props ) => {
53- if ( Object . keys ( window . testgen . plugins ) . includes ( id ) ) {
54- return window . testgen . plugins [ id ] ( props ) ;
55- }
56-
57- const loader = componentLoaders [ id ] ;
53+ const loader = window . testgen . plugins [ id ] ?? componentLoaders [ id ] ;
5854 if ( loader ) {
5955 const Component = await loader ( ) ;
6056 return Component ( props ) ;
@@ -141,10 +137,10 @@ async function loadPlugins() {
141137 try {
142138 const modules = await Promise . all ( Object . values ( pluginSpec ) . map ( plugin => import ( plugin . entrypoint ) ) )
143139 for ( const pluginModule of modules ) {
144- if ( pluginModule && pluginModule . components ) {
145- Object . assign ( window . testgen . plugins , pluginModule . components )
140+ if ( pluginModule && pluginModule . componentLoaders ) {
141+ Object . assign ( window . testgen . plugins , pluginModule . componentLoaders )
146142 } else if ( pluginModule ) {
147- console . warn ( `Plugin '${ pluginModule } ' does not export a member 'components '.` ) ;
143+ console . warn ( `Plugin '${ pluginModule } ' does not export a member 'componentLoaders '.` ) ;
148144 }
149145 }
150146 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments