Skip to content

Commit

Permalink
Studio: fix site not found error when add a site
Browse files Browse the repository at this point in the history
  • Loading branch information
kozer committed Aug 8, 2024
1 parent b22da76 commit 5bb3f25
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hooks/use-chat-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export const ChatProvider: React.FC< ChatProviderProps > = ( { children } ) => {
! initialLoad[ selectedSite.id ] &&
isCurrent &&
! pluginsList[ selectedSite.id ] &&
! themesList[ selectedSite.id ]
! themesList[ selectedSite.id ] &&
selectedSite.running === true &&
selectedSite.isAddingSite === false
) {
run();
}
Expand All @@ -140,7 +142,11 @@ export const ChatProvider: React.FC< ChatProviderProps > = ( { children } ) => {

useWindowListener( 'focus', async () => {
// When the window is focused, we need to kick off a request to refetch the theme details, if server is running.
if ( ! selectedSite?.id || selectedSite.running === false ) {
if (
! selectedSite?.id ||
selectedSite.running === false ||
selectedSite?.isAddingSite === true
) {
return;
}
const plugins = await fetchPluginList( selectedSite.id );
Expand Down

0 comments on commit 5bb3f25

Please sign in to comment.