diff --git a/.talismanrc b/.talismanrc
index 00c0fba..2fd7ede 100644
--- a/.talismanrc
+++ b/.talismanrc
@@ -10,7 +10,7 @@ fileignoreconfig:
- filename: Contentstack.Core/Models/Asset.cs
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
- filename: Contentstack.Core/Models/Query.cs
- checksum: ceea632e4ea870f35ad3bd313e9f8b4e5ec21aa86f006fca2e0a32945999ba67
+ checksum: eaf047e4ff77d92b5114f190e17fcc1e605bf8536e0406418d7ac1d0357d5110
- filename: Contentstack.Core/Models/Taxonomy.cs
checksum: db8bcefdc7aafde4286e7fb6d67348bec49f1ac27b54d84fddca8124135bd779
- filename: .github/workflows/nuget-publish.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88cbad8..bfd715a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+### Version: 2.19.0
+#### Date: Nov-30-2024
+
+##### Fix:
+- Remove updateLPContent call to resolve incorrect display of unsaved changes
+
### Version: 2.18.0
#### Date: Nov-18-2024
diff --git a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
index 82e51a8..4d960fc 100644
--- a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
+++ b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
@@ -31,6 +31,6 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Contentstack.Core.Tests/Contentstack.Core.Tests.csproj b/Contentstack.Core.Tests/Contentstack.Core.Tests.csproj
index 3fc0fee..6ed0529 100644
--- a/Contentstack.Core.Tests/Contentstack.Core.Tests.csproj
+++ b/Contentstack.Core.Tests/Contentstack.Core.Tests.csproj
@@ -8,13 +8,13 @@
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/Contentstack.Core/Configuration/Config.cs b/Contentstack.Core/Configuration/Config.cs
index ea4e353..f8b3406 100644
--- a/Contentstack.Core/Configuration/Config.cs
+++ b/Contentstack.Core/Configuration/Config.cs
@@ -99,7 +99,10 @@ internal string getLivePreviewUrl(LivePreviewConfig livePreviewConfig)
internal string getBaseUrl (LivePreviewConfig livePreviewConfig, string contentTypeUID)
{
- if (livePreviewConfig != null && livePreviewConfig.Enable && livePreviewConfig.ContentTypeUID == contentTypeUID)
+ if (livePreviewConfig != null
+ && livePreviewConfig.Enable
+ && livePreviewConfig.LivePreview != "init"
+ && livePreviewConfig.ContentTypeUID == contentTypeUID)
{
return getLivePreviewUrl(livePreviewConfig);
}
diff --git a/Contentstack.Core/ContentstackClient.cs b/Contentstack.Core/ContentstackClient.cs
index d8b949a..8734681 100644
--- a/Contentstack.Core/ContentstackClient.cs
+++ b/Contentstack.Core/ContentstackClient.cs
@@ -572,6 +572,8 @@ 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 54eae42..c6eff08 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.18.0";
+ request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.19.0";
request.Timeout = timeout;
if (proxy != null)
@@ -90,13 +90,6 @@ public async Task ProcessRequest(string Url, Dictionary
{
responseString = await plugin.OnResponse(client, request, response, responseString);
}
-
- if (isLivePreview == false && this.client.LivePreviewConfig.Enable == true)
- {
- JObject data = JsonConvert.DeserializeObject(responseString.Replace("\r\n", ""), this.client.SerializerSettings);
- updateLivePreviewContent(data);
- responseString = JsonConvert.SerializeObject(data);
- }
return responseString;
} else {
return null;
diff --git a/Contentstack.Core/Models/Query.cs b/Contentstack.Core/Models/Query.cs
index 1c59087..a6b453e 100644
--- a/Contentstack.Core/Models/Query.cs
+++ b/Contentstack.Core/Models/Query.cs
@@ -1830,19 +1830,6 @@ private async Task Exec()
Dictionary headerAll = new Dictionary();
Dictionary mainJson = new Dictionary();
- if (headers != null && headers.Count() > 0)
- {
- foreach (var header in headers)
- {
- if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
- && this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
- && header.Key == "access_token")
- {
- continue;
- }
- headerAll.Add(header.Key, (string)header.Value);
- }
- }
bool isLivePreview = false;
if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
&& this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId)
@@ -1859,7 +1846,27 @@ private async Task Exec()
isLivePreview = true;
}
+
+ if (headers != null && headers.Count() > 0)
+ {
+ foreach (var header in headers)
+ {
+ if (this.ContentTypeInstance.StackInstance.LivePreviewConfig.Enable == true
+ && this.ContentTypeInstance.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance.ContentTypeId
+ && header.Key == "access_token"
+ && isLivePreview)
+ {
+ continue;
+ }
+ headerAll.Add(header.Key, (string)header.Value);
+ }
+ }
+ if (!isLivePreview && headerAll.ContainsKey("preview_token"))
+ {
+ headerAll.Remove("preview_token");
+ }
+
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
if (QueryValueJson != null && QueryValueJson.Count > 0)
mainJson.Add("query", QueryValueJson);
diff --git a/Directory.Build.props b/Directory.Build.props
index 47a2019..f4c6c0f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,5 +1,5 @@
- 2.18.0
+ 2.19.0