Skip to content

Fix auto-updates on app launch by setting the value in NODE_ENV - #2234

Merged
sejas merged 2 commits into
trunkfrom
fix/stu-1122-auto-updates-not-triggering-on-app-launch
Dec 10, 2025
Merged

Fix auto-updates on app launch by setting the value in NODE_ENV#2234
sejas merged 2 commits into
trunkfrom
fix/stu-1122-auto-updates-not-triggering-on-app-launch

Conversation

@sejas

@sejas sejas commented Dec 10, 2025

Copy link
Copy Markdown
Member

Related issues

Proposed Changes

  • It passes the process.env.NODE_ENV to the packaged version
  • That will fix the auto-updates that expect the NODE_ENV to be production. See:

    studio/src/updates.ts

    Lines 22 to 24 in acacf62

    const shouldPoll =
    process.env.NODE_ENV === 'production' && app.isPackaged && ! isDevRelease( app.getVersion() );

Testing Instructions

Production

  • Locate the latest updated log in ~/Library/Logs/Studio/studio-20251210.0.log
  • Checkout this branch
  • Run npm install && npm run make
  • Find the .dmg created in out/make
  • Install and open the Studio app
  • Confirm you see in the log this output, and it doesn't mention Skipping auto-updates:
[2025-12-10T15:24:47.750Z][info][main] App version: 1.6.6
[2025-12-10T15:24:47.750Z][info][main] Environment: production

Development

  • Close the app and run npm start
  • Open the logs and confirm the output says development:
[2025-12-10T15:24:47.554Z][info][main] Skipping auto-updates {
  "env": "development",
  "isPackaged": false,
  "version": "1.6.6"
}
...
[2025-12-10T15:24:47.750Z][info][main] App version: 1.6.6
[2025-12-10T15:24:47.750Z][info][main] Environment: development

Before this changes NODE_EN was undefined

If you remove the line added in electron.vite.config.ts, and then make another build, then you'll see how NODE_ENV was undefined with this output in the log:

[2025-12-10T15:24:09.012Z][info][main] Skipping auto-updates {
  "isPackaged": true,
  "version": "1.6.6"
}
[2025-12-10T15:24:09.133Z][info][main] App version: 1.6.6
[2025-12-10T15:24:09.133Z][info][main] Environment: undefined

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Dec 10, 2025
@sejas
sejas requested a review from a team December 10, 2025 15:40
@sejas sejas changed the title Fix NODE_ENV and therefore fix auto updates on app launch Dec 10, 2025
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing eefa717 vs trunk

site-editor

Metric trunk eefa717 Diff Change
load 15013.00 ms 16480.00 ms +1467.00 ms 🔴 9.8%

site-startup

Metric trunk eefa717 Diff Change
siteCreation 23467.00 ms 23645.00 ms +178.00 ms 🔴 0.8%
siteStartup 9993.00 ms 10038.00 ms +45.00 ms 🔴 0.5%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @sejas! I have tested this, and it works as expected. I don't see the env and I can see the skipping message in the previous version, while I now see the environments, both production and development, and I don't see the skipping message in Production anymore. LGTM! :shipit:

Trunk This branch production This branch development
Image Image Image
@sejas
sejas merged commit 390d828 into trunk Dec 10, 2025
10 checks passed
@sejas
sejas deleted the fix/stu-1122-auto-updates-not-triggering-on-app-launch branch December 10, 2025 18:25
@wojtekn

wojtekn commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

@sejas thanks for the fix!

Which version introduced that issue?

sejas commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

The issue was introduced in Studio v1.6.0 when we switched to Vite. I also confirmed that auto-updates worked as expected in the previous version v1.5.6 ( pfHvTO-Au-p2 )

@wojtekn

wojtekn commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Thanks for confirming that @sejas .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants