Skip to content

Commit

Permalink
feat(sanity): minimise key
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed May 10, 2024
1 parent 2c9f3e2 commit 5661372
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/sanity/src/core/templates/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ export async function resolveValue<Params, InitialValue>(
options?: Options,
): Promise<InitialValue | undefined> {
const useCache = options?.useCache
// const debugContext = {projectId: context.projectId, dataset: context.dataset}
const debugContext = context
const debugParams = params ?? {}

if (typeof initialValueOpt === 'function') {
const cached = cache.get(initialValueOpt as InitialValueResolver<unknown, unknown>)
const key = JSON.stringify([debugParams, debugContext])

const key = JSON.stringify([
debugParams,
[context.projectId, context.dataset, context.currentUser?.id],
])

if (useCache && cached && cached[key]) {
return cached[key] as InitialValue | Promise<InitialValue>
Expand Down

0 comments on commit 5661372

Please sign in to comment.