We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7f0afad + 269b852 commit 73e46aeCopy full SHA for 73e46ae
1 file changed
src/preview/contentstack-live-preview-HOC.ts
@@ -152,7 +152,18 @@ class ContentstackLivePreview {
152
onChangeCallback;
153
}
154
155
- if (!skipInitialRender) {
+ const searchParams =
156
+ typeof window !== "undefined"
157
+ ? new URLSearchParams(window.location.search)
158
+ : null;
159
+ const hasLivePreviewHash =
160
+ searchParams && searchParams.has("live_preview");
161
+ const isBuilder = searchParams && searchParams.has("builder");
162
+ const shouldCallCallback = hasLivePreviewHash && isBuilder;
163
+ // calling onChangeCallback when live_preview search parameter
164
+ // is present because we don't send the initial client-data-send
165
+ // message in visual builder
166
+ if (!skipInitialRender || shouldCallCallback) {
167
onChangeCallback();
168
169
0 commit comments