From bd2e4063623cf059604f9bebd9b8f39d418e42a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 11 Dec 2024 17:19:06 +0100 Subject: [PATCH 1/2] [do not merge] Introduce extra requests on the initial path of the app --- pages/_document.tsx | 2 +- src/ui/setup/index.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pages/_document.tsx b/pages/_document.tsx index 428e4b410a5..f8a6bc1ca0b 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -31,7 +31,7 @@ const csp = (props: any) => { // localhost:8000 for prod to support the ?dispatch parameter when running // the local backend "http://localhost:* http://*.replay.local ws://*.replay.local ws://localhost:*" - }`, + } https://swapi.dev`, `frame-src replay: https://js.stripe.com https://hooks.stripe.com https://${authHost} https://www.loom.com/`, // Required by some of our external services `script-src 'self' 'unsafe-eval' https://cdn.lr-ingest.io https://cdn.lr-in.com https://js.stripe.com ${hash}`, diff --git a/src/ui/setup/index.ts b/src/ui/setup/index.ts index 52fe7e01f7b..2122ddbfa39 100644 --- a/src/ui/setup/index.ts +++ b/src/ui/setup/index.ts @@ -119,6 +119,13 @@ export const getInitialSourcesState = async (): Promise => { const IDB_PREFS_DATABASES = [CONSOLE_SETTINGS_DATABASE, POINTS_DATABASE]; +async function fetchAndLog(url: string): Promise { + const response = await fetch(url); + const json = await response.json(); + console.log(json); + return json; +} + export async function bootstrapApp(accessToken: string | null) { const recordingId = getRecordingId(); @@ -144,6 +151,11 @@ export async function bootstrapApp(accessToken: string | null) { const store = bootstrapStore(initialState); + try { + const response = await fetchAndLog("https://swapi.dev/api/people"); + await fetchAndLog(response.next); + } catch {} + if (typeof window === "undefined") { return store; } From edd5c724f15a59a06f21e311208f26470c28d94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 11 Dec 2024 21:37:02 +0100 Subject: [PATCH 2/2] empty commit