Skip to content

Commit

Permalink
Use type param instead of type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Jan 31, 2025
1 parent 4774ba2 commit 7ca6eb9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/next/src/server/use-cache/use-cache-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,14 @@ async function generateCacheEntryImpl(
): Promise<[ReadableStream, Promise<CacheEntry>]> {
const temporaryReferences = createServerTemporaryReferenceSet()

const cacheKeyParts =
const [, , , args] =
typeof encodedArguments === 'string'
? await decodeReply<any[]>(encodedArguments, getServerModuleMap(), {
temporaryReferences,
})
: await decodeReplyFromAsyncIterable<any[]>(
? await decodeReply<CacheKeyParts>(
encodedArguments,
getServerModuleMap(),
{ temporaryReferences }
)
: await decodeReplyFromAsyncIterable<CacheKeyParts>(
{
async *[Symbol.asyncIterator]() {
for (const entry of encodedArguments) {
Expand Down Expand Up @@ -331,8 +333,6 @@ async function generateCacheEntryImpl(
{ temporaryReferences }
)

const [, , , args] = cacheKeyParts as CacheKeyParts

// Track the timestamp when we started computing the result.
const startTime = performance.timeOrigin + performance.now()
// Invoke the inner function to load a new result.
Expand Down

0 comments on commit 7ca6eb9

Please sign in to comment.