From c3ad7adc6054e82d3ffead8174529e180893a2b1 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Thu, 19 Dec 2024 18:43:03 +0530 Subject: [PATCH 1/2] fix: Reset LivePreviewConfig to prevent overwriting fetched data with live preview data during regular fetch calls --- CHANGELOG.md | 6 ++++++ Contentstack.Core/Contentstack.Core.csproj | 1 - Contentstack.Core/ContentstackClient.cs | 6 ++++-- Contentstack.Core/Internals/HttpRequestHandler.cs | 2 +- Directory.Build.props | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd715a..ae8dc8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### Version: 2.20.0 +#### Date: Dec-19-2024 + +##### Fix: +- Reset `LivePreviewConfig` to prevent overwriting fetched data with live preview data during regular fetch calls. + ### Version: 2.19.0 #### Date: Nov-30-2024 diff --git a/Contentstack.Core/Contentstack.Core.csproj b/Contentstack.Core/Contentstack.Core.csproj index 030a3a7..218166d 100644 --- a/Contentstack.Core/Contentstack.Core.csproj +++ b/Contentstack.Core/Contentstack.Core.csproj @@ -14,7 +14,6 @@ https://github.com/contentstack/contentstack-dotnet LICENSE.txt README.md - $(Version) diff --git a/Contentstack.Core/ContentstackClient.cs b/Contentstack.Core/ContentstackClient.cs index 8734681..b86d2f4 100644 --- a/Contentstack.Core/ContentstackClient.cs +++ b/Contentstack.Core/ContentstackClient.cs @@ -555,6 +555,10 @@ public void SetHeader(string key, string value) /// public async Task LivePreviewQueryAsync(Dictionary query) { + this.LivePreviewConfig.LivePreview = null; + this.LivePreviewConfig.ContentTypeUID = null; + this.LivePreviewConfig.EntryUID = null; + if (query.Keys.Contains("content_type_uid")) { string contentTypeUID = null; @@ -572,8 +576,6 @@ public async Task LivePreviewQueryAsync(Dictionary query) string hash = null; query.TryGetValue("live_preview", out hash); this.LivePreviewConfig.LivePreview = hash; - } else { - this.LivePreviewConfig.LivePreview = "init"; } this.LivePreviewConfig.PreviewResponse = await GetLivePreviewData(); } diff --git a/Contentstack.Core/Internals/HttpRequestHandler.cs b/Contentstack.Core/Internals/HttpRequestHandler.cs index c6eff08..6252f51 100644 --- a/Contentstack.Core/Internals/HttpRequestHandler.cs +++ b/Contentstack.Core/Internals/HttpRequestHandler.cs @@ -48,7 +48,7 @@ public async Task ProcessRequest(string Url, Dictionary var request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; request.ContentType = "application/json"; - request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.19.0"; + request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.20.0"; request.Timeout = timeout; if (proxy != null) diff --git a/Directory.Build.props b/Directory.Build.props index f4c6c0f..2beb17e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 2.19.0 + 2.20.0 From 3158b0e700ef1ebf51381b3d338941380bbe07b8 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Thu, 19 Dec 2024 18:54:36 +0530 Subject: [PATCH 2/2] chore: release version tag added --- Contentstack.Core/Contentstack.Core.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Contentstack.Core/Contentstack.Core.csproj b/Contentstack.Core/Contentstack.Core.csproj index 218166d..030a3a7 100644 --- a/Contentstack.Core/Contentstack.Core.csproj +++ b/Contentstack.Core/Contentstack.Core.csproj @@ -14,6 +14,7 @@ https://github.com/contentstack/contentstack-dotnet LICENSE.txt README.md + $(Version)