From a588b3a42a56461f71d4380e74fb442fe085d459 Mon Sep 17 00:00:00 2001 From: Ben Merckx Date: Mon, 7 Oct 2024 16:40:10 +0200 Subject: [PATCH] Use dev url --- src/adapter/next/cms.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/adapter/next/cms.tsx b/src/adapter/next/cms.tsx index 6a4a7c51b..6d03a8e90 100644 --- a/src/adapter/next/cms.tsx +++ b/src/adapter/next/cms.tsx @@ -35,7 +35,7 @@ export class NextCMS< const database = generatedStore.then( store => new Database(this.config, store) ) - const resolver = database.then( + const dbResolver = database.then( db => new EntryResolver(db, this.config.schema) ) super(config, async () => { @@ -56,10 +56,11 @@ export class NextCMS< const payload = getPreviewPayloadFromCookies(cookie.getAll()) if (payload) resolveDefaults.preview = {payload} } + if (devUrl()) return new Client({url, applyAuth, resolveDefaults}) const client = new NextClient( { async resolve(params) { - const dbResolver = await resolver + const resolver = await dbResolver if (!params.preview && !isBuild) { const syncInterval = params.syncInterval ?? 60 const now = Date.now() @@ -69,7 +70,7 @@ export class NextCMS< await db.syncWith(client).catch(() => {}) } } - return dbResolver.resolve({...resolveDefaults, ...params}) + return resolver.resolve({...resolveDefaults, ...params}) } }, {