Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

Addresses UI lag (~2 seconds of unresponsiveness) on desktop app startup by:

  1. Lazy loading extension globals - Changed import.meta.glob from eager to lazy loading and only initialize extension globals for iframe/extension contexts. This defers heavy UI component loading until actually needed.

  2. Show loading UI immediately - Display a loading spinner while the TinyBase store initializes instead of rendering nothing (null), making the app feel responsive immediately.

  3. Reduce window show delay - Decreased the hardcoded sleep in window show from 100ms to 10ms.

Review & Testing Checklist for Human

  • Test extension functionality - Verify that extensions still work correctly in iframe contexts since initExtensionGlobals() is now only called there and loads modules asynchronously
  • Test startup on macOS - Confirm the app starts faster and the loading spinner displays correctly without visual glitches
  • Test window show behavior - Verify the 10ms sleep doesn't cause race conditions (window appearing before content is ready)
  • Test that main window works normally - Since extension globals are no longer initialized for the main window, verify nothing in the main app depends on window.__hyprnote or related globals

Recommended test plan:

  1. Launch the app fresh and observe startup behavior - should see spinner briefly then main UI
  2. Open an extension that uses the runtime globals to verify lazy loading works
  3. Test on both debug and release builds

Notes

  • The original 100ms sleep may have been masking a real timing issue - if visual glitches appear, may need to adjust or use the existing show_async with proper readiness signaling
  • The loading spinner uses inline styles to avoid any CSS loading dependencies

Link to Devin run: https://app.devin.ai/sessions/7c7cd7abf4134af2b9f6d813d18c9acd
Requested by: john@hyprnote.com (@ComputelessComputer)

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 68633a9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69539a1bb355d500088fdb36

@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit 68633a9
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/69539a1bb355d500088fdb3a

@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 68633a9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69539a1b65248f000862c501

@yujonglee
Copy link
Contributor

/staging

@github-actions
Copy link

Branch Commit Status
devin/1767003523-optimize-startup-performance c1e4f370 View

@yujonglee
Copy link
Contributor

@ComputelessComputer please review if it work(no regression + faster startup)

- Gate extension globals loading for iframe contexts only, deferring heavy
  UI component loading until actually needed by extensions
- Change import.meta.glob from eager to lazy loading for UI components
- Add loading spinner UI while store initializes instead of blank screen
- Reduce window show sleep from 100ms to 10ms

These changes should significantly reduce the ~2 second UI unresponsiveness
on startup by:
1. Avoiding synchronous loading of all UI components at startup
2. Showing responsive UI immediately while store loads in background
3. Reducing artificial delay in window show

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@ComputelessComputer
Copy link
Collaborator

@ComputelessComputer please review if it work(no regression + faster startup)

i think this does reduce the overhead by 1~2 seconds but it is most definitely awful having a blank white screen on startup.

opti.mp4

@ComputelessComputer ComputelessComputer force-pushed the devin/1767003523-optimize-startup-performance branch from c1e4f37 to 1010474 Compare December 30, 2025 09:22
@ComputelessComputer ComputelessComputer force-pushed the devin/1767003523-optimize-startup-performance branch from 1010474 to 68633a9 Compare December 30, 2025 09:23
@ComputelessComputer
Copy link
Collaborator

updated splash from spinner to skeleton

@ComputelessComputer ComputelessComputer deleted the devin/1767003523-optimize-startup-performance branch January 1, 2026 12:23
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.

3 participants