Download next.js/packages/next/src/client/app-build-id.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 964 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/app-build-id.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/client/app-build-id.ts
-
curl -L -o app-build-id.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/app-build-id.ts
964 Bytes
| // This gets assigned as a side-effect during app initialization. Because it | |
| // represents the build used to create the JS bundle, it should never change | |
| // after being set, so we store it in a global variable. | |
| // | |
| // When performing RSC requests, if the incoming data has a different build ID, | |
| // we perform an MPA navigation/refresh to load the updated build and ensure | |
| // that the client and server in sync. | |
| // Starts as an empty string. In practice, because setAppBuildId is called | |
| // during initialization before hydration starts, this will always get | |
| // reassigned to the actual build ID before it's ever needed by a navigation. | |
| // If for some reasons it didn't, due to a bug or race condition, then on | |
| // navigation the build comparision would fail and trigger an MPA navigation. | |
| let globalBuildId: string = '' | |
| export function setAppBuildId(buildId: string) { | |
| globalBuildId = buildId | |
| } | |
| export function getAppBuildId(): string { | |
| return globalBuildId | |
| } | |