fix: call onChangeCallback when live_preview parameter is present in URL#363
Merged
faraazb merged 5 commits intodevelop_v3from Mar 17, 2025
Merged
Conversation
Visual Builder doesn't send client-data-send on site load, this leads to the site not making any calls to the preview service which is required for the subsequent entry PATCH requests to work correctly. onChangeCallback is called when either skipInitialRender is false or when live_preview search parameter is present in the URL. Since Visual Builder provides these values through the search parameter, the site makes entry GET calls to the preview service. Since live preview doesn't provide these params in non-SSR modes, it will continue to work the same.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Contributor
Author
|
This may be a problem in Preview, as they send the client-data-send on initial load. And they also have live_preview in search parameters. This will lead to onChangeCallback being called twice. |
Contributor
Author
|
I have made some additions which ensure that onChange is only called once on site load. |
Stage: v3.1.2
a3ddc4e to
f516301
Compare
feat: v3.1.2
Avoid calling onLiveEdit in apps other than builder as it can lead to multiple calls in Timeline and LP. Resolving this issue would then require storing some state to ensure the callback is only called from one code location on the first load which then has the posssibiliy of breaking setups that rely on the behaviour of the callback being called multiple times.
f516301 to
98562c7
Compare
Contributor
Author
|
The failing unit tests are being removed in another PR and some other tests are being added in its place. We can safely ignore them for now. |
c9518d5 to
269b852
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the site not making any calls to the preview service which is required
for the subsequent entry PATCH requests to work correctly.
onChangeCallbackis called when eitherskipInitialRenderis false orwhen live_preview search parameter is present in the URL.