Skip to content

Conversation

@PatrikBird
Copy link
Contributor

@PatrikBird PatrikBird commented Dec 6, 2025

Add SSR guards to DevTools registration functions to prevent memory leaks in server-side environments by checking both __DEV__ and isClient.

Fixes #4978

🔎 Overview

This PR fixes a memory leak in SSR environments like Nuxt, where the DevTools registration functions were running on the server-side, causing component references to accumulate in memory across requests. I've tested this fix locally and can confirm it successfully eliminates the need for the NODE_ENV=production workaround as described in #4978.

🤓 Code snippets/examples

export function registerFormWithDevTools(form: PrivateFormContext) {
    if (!__DEV__ || !isClient) {
      return; // Exit immediately on server or in production
    }
    // ... rest of function
  }

Issues affected
closes #4978

PS: I'll create another PR #5102 for the v4 Branch. :)

Add SSR guards to DevTools registration functions to prevent memory leaks
in server-side environments by checking both __DEV__ and isClient.

Fixes logaretm#4978
@changeset-bot
Copy link

changeset-bot bot commented Dec 6, 2025

🦋 Changeset detected

Latest commit: 45df338

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Dec 6, 2025

Deploy Preview for vee-validate-docs canceled.

Name Link
🔨 Latest commit 45df338
🔍 Latest deploy log https://app.netlify.com/projects/vee-validate-docs/deploys/6934156d069ba70008a7f0b8

@netlify
Copy link

netlify bot commented Dec 6, 2025

Deploy Preview for vee-validate-v5 ready!

Name Link
🔨 Latest commit 45df338
🔍 Latest deploy log https://app.netlify.com/projects/vee-validate-v5/deploys/6934156d8bf0b100089c1601
😎 Deploy Preview https://deploy-preview-5101--vee-validate-v5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Owner

@logaretm logaretm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@logaretm logaretm merged commit f2807b8 into logaretm:main Dec 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev tools memory leak in prod builds - consider make devtools opt-in?

3 participants