-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: fetch extensions from API for core profiler
- prefetch it once in the machine init so that it's instant when used later - fetch it again in preExtensions state and store it to context
- Loading branch information
Showing
2 changed files
with
72 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
plugins/woocommerce-admin/client/core-profiler/pages/Extensions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { CoreProfilerStateMachineContext, ExtensionsEvent } from '../index'; | ||
|
||
export const Extensions = ( { | ||
context, | ||
sendEvent, | ||
}: { | ||
context: CoreProfilerStateMachineContext; | ||
sendEvent: ( payload: ExtensionsEvent ) => void; | ||
} ) => { | ||
return ( | ||
<> | ||
<div>Extensions</div> | ||
<div>{ JSON.stringify( context.extensionsAvailable ) }</div> | ||
<button | ||
onClick={ () => | ||
sendEvent( { | ||
type: 'EXTENSIONS_COMPLETED', | ||
payload: { | ||
extensionsSelected: [ 'woocommerce-payments' ], | ||
}, | ||
} ) | ||
} | ||
> | ||
Next | ||
</button> | ||
</> | ||
); | ||
}; |