We are excited to introduce a new feature: the hydrationDone
event in our funnel and website builder preview. This update is designed to make the execution of your custom code more seamless and efficient.
Previously, users might have encountered issues where their custom scripts executed before the preview hydration was complete. This timing mismatch could lead to an incorrect execution flow and hinder the proper functionality of your custom code.
By dispatching the ‘hydrationDone’ event after the complete hydration of the preview, we’ve effectively eliminated this source of contention. Now users can add an event listener to the hydrationDone
event and ensure their subsequent code runs post-hydration. This is particularly useful if you are trying to manipulate DOM content immediately after the preview loads.
To utilize this new feature, follow these simple steps:
hydrationDone
event using the following example code:
document.addEventListener(
"hydrationDone",
() => {
// Add custom javascript here
}
);
Note: If your custom code is critical on page load, you may need to disable Optimize JavaScript, as it delays the hydration event if there is no user interaction.
This new feature aims to streamline your workflow and ensure that your custom scripts execute precisely when needed, enhancing the overall functionality and performance of your funnel or website.
In Case You Missed It:
Impressive Upgrade: Automate Your Social Media Comments with Leads 365