-
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: core profiler fetch extensions (#38270)
add: fetch extensions and countries 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 - added prefetch for getCountries as well
- Loading branch information
Showing
3 changed files
with
87 additions
and
36 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> | ||
</> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
plugins/woocommerce/changelog/add-core-profiler-fetch-extensions
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,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Added async fetching for extensions and countries lists in new core profiler |