diff --git a/src/components/hanzi-data/index.ts b/src/components/hanzi-data/index.ts index 4656ecfb660419458664e8a573d8ef2d356488bb..a1f1b8ce10d61ef8e194ade01f56b94b42c179d3 100644 --- a/src/components/hanzi-data/index.ts +++ b/src/components/hanzi-data/index.ts @@ -37,12 +37,10 @@ export async function getHanziData ( throw new Error(`Can only get data for single chars, got: ${char}`) } - if (char in cached) { - return cached[char] - } - let data: Readonly<HanziData> - if (canAccessFilesystem) { + if (char in cached) { + data = cached[char] + } else if (canAccessFilesystem) { // read directly from disk when running in test and skip the cache data = await fetchNonBrowser(char) } else {