Add a fix to ensure the html layer is still in use when trying to update the img element.
In React 18 in <StrictMode />, the lazyload plugin does not work as expected. The issue is that since the plugin's promise is being resolved after a new instance of HtmlImageLayer is created, the previous HtmlImageLayer is updating the img element with the src which is not the expected behavior.
Pull request for cloudinary/frontend-frameworks
For which package is this PR?
@cloudinary/html
@cloudinary/react
What does this PR solve?
Add a fix to ensure the html layer is still in use when trying to update the
img
element.In React 18 in
<StrictMode />
, thelazyload
plugin does not work as expected. The issue is that since the plugin's promise is being resolved after a new instance ofHtmlImageLayer
is created, the previousHtmlImageLayer
is updating theimg
element with thesrc
which is not the expected behavior.Final checklist