Skip to content

Error in EnhancedForm_destroy - Uncaught (in promise) TypeError: EnhancedForm.remove is not a function #500

Open
@oscarhermoso

Description

@oscarhermoso
  • Before posting an issue, read the FAQ and search the previous issues.

Description

I have a pretty dense SPA superform component that throws an error from EnhancedForm_destroy, because of Uncaught (in promise) TypeError: EnhancedForm.remove is not a function.

It seems that EnhancedForm is expected to be a HTMLElement with a remove() method. This is fine on Chrome.

However, on Firefox, there is no remove() method - I believe it is a DOM Node.

EDIT: I have reproduced on both Chrome and Firefox.

2024-11-02.16-57-54.mp4

The error is bubbling from here:

function EnhancedForm_destroy() {
if (EnhancedForm?.parentElement) {
EnhancedForm.remove();
}
EnhancedForm = undefined;
}

onDestroy(() => {
Unsubscriptions_unsubscribe();
NextChange_clear();
EnhancedForm_destroy();
for (const events of Object.values(formEvents)) {
events.length = 0;
}
formIds.get(_currentPage)?.delete(_initialFormId);
});

If applicable, a MRE

Apologies, I have attempted to reproduce in a minimal REPL, but I have been unable to.

Discovered error on sveltekit-superforms v2.12.3, attempted to upgrade to sveltekit-superforms, v2.19.1 and issue is still occurring.

Firefox version 126.0 (64-bit)
Chrome Version 128.0.6613.137

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions