Skip to content

Commit 582c492

Browse files
committed
fix(vue): destroy node in onSSRComplete
1 parent 528d6e3 commit 582c492

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/vue/src/composables/useInput.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {
4141
} from 'vue'
4242
import { FormKitInputs } from '@formkit/inputs'
4343
import { optionsSymbol } from '../plugin'
44+
import { onSSRComplete } from './onSSRComplete'
4445
import { FormKitGroupValue } from 'packages/core/src'
4546
import { FormKitPseudoProps } from '@formkit/core'
4647

@@ -482,5 +483,11 @@ export function useInput<
482483
*/
483484
onBeforeUnmount(() => node.destroy())
484485

486+
/**
487+
* `onBeforeUnmount` never fires during SSR, so we destroy the node here to
488+
* free it from module-level registries and avoid leaking it across requests.
489+
*/
490+
onSSRComplete(instance?.appContext.app, () => node.destroy())
491+
485492
return node
486493
}

0 commit comments

Comments
 (0)