mirror of
https://github.com/novuhq/novu.git
synced 2026-03-13 10:41:26 +08:00
fix(dashboard): email step block editor content not saved after refresh fixes NV-7106 (#10013)
This commit is contained in:
@@ -77,6 +77,23 @@ export function EditStepTemplateV2Page() {
|
||||
return null;
|
||||
}
|
||||
|
||||
const formValues = form.getValues();
|
||||
const hasFormValues = Object.keys(formValues).length > 0;
|
||||
const stepControlValues = step.controls.values;
|
||||
const hasStepControlValues = stepControlValues && Object.keys(stepControlValues).length > 0;
|
||||
|
||||
// Wait for form to sync with step values when step has values to sync
|
||||
// If stepControlValues is undefined, step hasn't loaded yet - don't render
|
||||
// If stepControlValues is defined but has values, wait for form to sync - don't render until hasFormValues is true
|
||||
// If stepControlValues is defined but empty {}, that's valid - render immediately
|
||||
if (stepControlValues === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hasStepControlValues && !hasFormValues) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageMeta title={`Edit ${step.name} Template`} />
|
||||
|
||||
@@ -139,6 +139,7 @@ export function SlashCommandItem(props: SlashCommandItemProps) {
|
||||
onClick={() => selectItem(groupIndex, commandIndex)}
|
||||
onMouseEnter={() => onHover(true)}
|
||||
onMouseLeave={() => onHover(false)}
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
type="button"
|
||||
ref={isActive ? activeCommandRef : null}
|
||||
data-item-key={itemKey}
|
||||
|
||||
Reference in New Issue
Block a user