Skip to content

Commit 214f4d6

Browse files
committed
Simplify logic
1 parent c2f2fc7 commit 214f4d6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

node_package/src/loadReactClientManifest.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ export default async function loadReactClientManifest(reactClientManifestFileNam
1010
// Thus, the __dirname of this code is where we can find the manifest file.
1111
const manifestPath = path.resolve(__dirname, reactClientManifestFileName);
1212
const loadedReactClientManifest = loadedReactClientManifests.get(manifestPath);
13-
if (!loadedReactClientManifest) {
14-
// TODO: convert to async
15-
try {
16-
const manifest = JSON.parse(await fs.readFile(manifestPath, 'utf8')) as ClientManifest;
17-
loadedReactClientManifests.set(manifestPath, manifest);
18-
return manifest;
19-
} catch (error) {
20-
throw new Error(`Failed to load React client manifest from ${manifestPath}: ${error}`);
21-
}
13+
if (loadedReactClientManifest) {
14+
return loadedReactClientManifest;
2215
}
2316

24-
return loadedReactClientManifest;
17+
// TODO: convert to async
18+
try {
19+
const manifest = JSON.parse(await fs.readFile(manifestPath, 'utf8')) as ClientManifest;
20+
loadedReactClientManifests.set(manifestPath, manifest);
21+
return manifest;
22+
} catch (error) {
23+
throw new Error(`Failed to load React client manifest from ${manifestPath}: ${error}`);
24+
}
2525
}

0 commit comments

Comments
 (0)