From 09b002cb50689ddc813a1ee2883355e9bcb3579e Mon Sep 17 00:00:00 2001 From: RJ <27843274+rjchow@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:48:40 +0800 Subject: [PATCH] add: lys prefetch congrats data (#46406) --- .../client/launch-your-store/hub/sidebar/xstate.tsx | 8 ++++++++ .../woocommerce/changelog/add-lys-prefetch-congrats-data | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 plugins/woocommerce/changelog/add-lys-prefetch-congrats-data diff --git a/plugins/woocommerce-admin/client/launch-your-store/hub/sidebar/xstate.tsx b/plugins/woocommerce-admin/client/launch-your-store/hub/sidebar/xstate.tsx index a0b9953a8a0..077c855af17 100644 --- a/plugins/woocommerce-admin/client/launch-your-store/hub/sidebar/xstate.tsx +++ b/plugins/woocommerce-admin/client/launch-your-store/hub/sidebar/xstate.tsx @@ -8,6 +8,7 @@ import { fromCallback, fromPromise, assign, + spawnChild, } from 'xstate5'; import React from 'react'; import classnames from 'classnames'; @@ -23,6 +24,7 @@ import type { LaunchYourStoreComponentProps } from '..'; import type { mainContentMachine } from '../main-content/xstate'; import { updateQueryParams, createQueryParamsListener } from '../common'; import { taskClickedAction, getLysTasklist } from './tasklist'; +import { fetchCongratsData } from '../main-content/pages/launch-store-success/services'; export type SidebarMachineContext = { externalUrl: string | null; @@ -116,6 +118,7 @@ export const sidebarMachine = setup( { sidebarQueryParamListener, getTasklist: fromPromise( getLysTasklist ), updateLaunchStoreOptions: fromPromise( launchStoreAction ), + fetchCongratsData, }, } ).createMachine( { id: 'sidebar', @@ -155,6 +158,11 @@ export const sidebarMachine = setup( { initial: 'preLaunchYourStoreHub', states: { preLaunchYourStoreHub: { + entry: [ + spawnChild( 'fetchCongratsData', { + id: 'prefetch-congrats-data ', + } ), + ], invoke: { src: 'getTasklist', onDone: { diff --git a/plugins/woocommerce/changelog/add-lys-prefetch-congrats-data b/plugins/woocommerce/changelog/add-lys-prefetch-congrats-data new file mode 100644 index 00000000000..72898bacb34 --- /dev/null +++ b/plugins/woocommerce/changelog/add-lys-prefetch-congrats-data @@ -0,0 +1,5 @@ +Significance: patch +Type: add + +Adds a prefetch for the LYS congrats data +