add: lys prefetch congrats data (#46406)

This commit is contained in:
RJ 2024-04-11 12:48:40 +08:00 committed by GitHub
parent 5a57525bd6
commit 09b002cb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import {
fromCallback, fromCallback,
fromPromise, fromPromise,
assign, assign,
spawnChild,
} from 'xstate5'; } from 'xstate5';
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
@ -23,6 +24,7 @@ import type { LaunchYourStoreComponentProps } from '..';
import type { mainContentMachine } from '../main-content/xstate'; import type { mainContentMachine } from '../main-content/xstate';
import { updateQueryParams, createQueryParamsListener } from '../common'; import { updateQueryParams, createQueryParamsListener } from '../common';
import { taskClickedAction, getLysTasklist } from './tasklist'; import { taskClickedAction, getLysTasklist } from './tasklist';
import { fetchCongratsData } from '../main-content/pages/launch-store-success/services';
export type SidebarMachineContext = { export type SidebarMachineContext = {
externalUrl: string | null; externalUrl: string | null;
@ -116,6 +118,7 @@ export const sidebarMachine = setup( {
sidebarQueryParamListener, sidebarQueryParamListener,
getTasklist: fromPromise( getLysTasklist ), getTasklist: fromPromise( getLysTasklist ),
updateLaunchStoreOptions: fromPromise( launchStoreAction ), updateLaunchStoreOptions: fromPromise( launchStoreAction ),
fetchCongratsData,
}, },
} ).createMachine( { } ).createMachine( {
id: 'sidebar', id: 'sidebar',
@ -155,6 +158,11 @@ export const sidebarMachine = setup( {
initial: 'preLaunchYourStoreHub', initial: 'preLaunchYourStoreHub',
states: { states: {
preLaunchYourStoreHub: { preLaunchYourStoreHub: {
entry: [
spawnChild( 'fetchCongratsData', {
id: 'prefetch-congrats-data ',
} ),
],
invoke: { invoke: {
src: 'getTasklist', src: 'getTasklist',
onDone: { onDone: {

View File

@ -0,0 +1,5 @@
Significance: patch
Type: add
Adds a prefetch for the LYS congrats data