@kontakto/email-template-editor 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4969,14 +4969,15 @@ var EmailEditor = React81.forwardRef((props, ref) => {
4969
4969
  saveAs,
4970
4970
  theme
4971
4971
  } = props;
4972
- const resolvedTemplate = typeof initialTemplateProp === "string" ? htmlToEditorConfig(initialTemplateProp) : initialTemplateProp;
4973
- const initializedRef = React81.useRef(false);
4972
+ const resolvedTemplate = React81.useMemo(
4973
+ () => typeof initialTemplateProp === "string" ? htmlToEditorConfig(initialTemplateProp) : initialTemplateProp,
4974
+ [initialTemplateProp]
4975
+ );
4976
+ const prevTemplateRef = React81.useRef(void 0);
4974
4977
  React81.useEffect(() => {
4975
- if (!initializedRef.current) {
4976
- initializedRef.current = true;
4977
- if (resolvedTemplate) {
4978
- resetDocument(resolvedTemplate);
4979
- }
4978
+ if (resolvedTemplate && resolvedTemplate !== prevTemplateRef.current) {
4979
+ prevTemplateRef.current = resolvedTemplate;
4980
+ resetDocument(resolvedTemplate);
4980
4981
  }
4981
4982
  }, [resolvedTemplate]);
4982
4983
  React81.useEffect(() => {