发布

  • [OPIK-6149] [FE] perf: parallelize plugin module imports (#6434)

    frostbyte_neo 发布于 2026-04-22 12:32:27 +00:00

    PluginsStore.setupPlugins() awaited each dynamic import inside a for
    loop, serializing 17 plugin fetches that each cost ~100-300ms. On
    fresh signups this phase took 4.5–5.8s on dev.comet.com and was the
    largest single contributor to LCP.

    Swap the loop for Promise.all so all plugins fetch in parallel. No
    consumer depends on load order; every reader uses a zustand selector
    and re-renders when its field populates. The per-item try/catch is
    preserved so a missing plugin file still short-circuits to "skip".

    Also fires init.tsx (the plugin that triggers config.js + PostHog +
    Segment + FullStory init) concurrently with other plugins instead of
    last in the sequence, so third-party SDK init starts ~4s earlier.

    Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件