Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] Introduce extra requests on the initial path of the app #10627

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
12 changes: 12 additions & 0 deletions src/ui/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export const getInitialSourcesState = async (): Promise<SourcesState> => {

const IDB_PREFS_DATABASES = [CONSOLE_SETTINGS_DATABASE, POINTS_DATABASE];

async function fetchAndLog(url: string): Promise<any> {
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();

Expand All @@ -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;
}
Expand Down
Loading