Skip to content

double network calls in React #871

@pdurbin

Description

@pdurbin

@g-saracca shared with me the following tip for disabling double network calls in React:

% git diff src/index.tsx
diff --git a/src/index.tsx b/src/index.tsx
index 534a26ff..ff2b7fc1 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -4,7 +4,7 @@ import { KcPage } from './keycloak-theme/kc.gen'
 const AppEntrypoint = lazy(() => import('./index.app'))

 createRoot(document.getElementById('root') as HTMLElement).render(
- <StrictMode>
+ <>
     {window.kcContext ? (
       <KcPage kcContext={window.kcContext} />
     ) : (
@@ -12,5 +12,5 @@ createRoot(document.getElementById('root') as HTMLElement).render(
         <AppEntrypoint />
       </Suspense>
     )}
- </StrictMode>
+ </>
 )

This change should not be committed but it's helpful in development to reduce the noise.

We should explain this in the dev guide or make it a config option, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions