refactor(suite): separate app composition from initialization - #32195
Conversation
⚡️ Performance report (alpha)Note Alpha release: The limits are still being calibrated, and each measurement is desktop / group 2🟢 Within limits.Each metric reads
desktop / group 5🟢 Within limits.Each metric reads
desktop / group 3🟢 Within limits.Each metric reads
desktop / group 1🟢 Within limits.Each metric reads
desktop / group 4🟢 Within limits.Each metric reads
desktop / group 6🟢 Within limits.Each metric reads
desktop / group 7🟢 Within limits.Each metric reads
|
8118cd1 to
0d055a5
Compare
0d055a5 to
2df9532
Compare
2df9532 to
88b095e
Compare
| export * from '@testing-library/user-event'; | ||
|
|
||
| // Re-export store types from @trezor/suite | ||
| export type { PreloadedState } from '@trezor/suite'; |
There was a problem hiding this comment.
This seems to be completely unused. 😱
| // When we run this first time `shouldRunTor` will tell if Tor should run according to previous settings, | ||
| // when it runs because of renderer (e.g. Ctrl+R) it will always be false. | ||
| if (shouldRunTor) { | ||
| await new Promise(resolve => { |
There was a problem hiding this comment.
like, wat? It runs root.render() twice? Here and line:84?
There was a problem hiding this comment.
yup, masterpiece :D
Description
Make the web and desktop composition roots synchronous and return an async init service, so service wiring is independent of application startup. Create the Redux store during composition and hydrate that same store after storage preloading and the desktop handshake, preserving preload behavior without running application middleware during hydration.
🤖 LLM Test Recommendations
Summary: The changed files are concentrated in app initialization, web/desktop composition roots, and Redux store creation/hydration. The biggest risks are app startup failures, broken persisted-state/migration behavior, and regressions in TrezorConnect or bridge initialization. A small, targeted smoke suite covering initial run, database migrations, browser entry gates, desktop bridge lifecycle, and representative TrezorConnect flows provides high confidence without running the full catalog.
Changed files (22)
packages/suite-desktop-ui/src/MainDesktop.tsxpackages/suite-desktop-ui/src/createDesktopInit.tsxpackages/suite-desktop-ui/src/createSuiteDesktopCompositionRoot.tspackages/suite-desktop-ui/src/index.tsxpackages/suite-web/src/MainWeb.tsxpackages/suite-web/src/createSuiteWebCompositionRoot.tspackages/suite-web/src/createWebInit.tsxpackages/suite-web/src/index.tspackages/suite-web/src/static/vite-index.tspackages/suite/index.tspackages/suite/src/reducers/createHydrateReduxStore.tspackages/suite/src/reducers/createReduxStore.tspackages/suite/src/reducers/store.tspackages/suite/src/support/createConnectLoggerFactory.tspackages/suite/src/support/createGetBinFilesBaseUrl.tspackages/suite/src/support/suite/preloadStore.tssuite/test-utils/package.jsonsuite/test-utils/src/StoreProviderForTests.tsxsuite/test-utils/src/index.tssuite/test-utils/src/initStoreForTests.tssuite/test-utils/src/renderWithStore.tsxsuite/test-utils/tsconfig.jsonRecommended tests (10)
🔴 High priority (10)
suite/e2e/tests/suite/initial-run.test.ts— Verifies onboarding/analytics consent state persists across reloads and that the app reaches a connected-device state after initial run. This directly exercises the web composition root, init flow, and Redux store hydration/preload logic.suite/e2e/tests/suite/db-migration.test.ts— Tests IndexedDB migration of persisted user settings between Suite versions, which relies on the updated store creation, hydration, and preload-store code paths.suite/e2e/tests/suite/db-locale-migration.test.ts— Validates that language preference survives a cross-version database migration and app reload, directly exercising persisted store hydration and initialization.suite/e2e/tests/browser/firefox.test.ts— Confirms the web app loads and the unsupported-browser gate behaves correctly in Firefox, exercising the web entry point and composition root initialization.suite/e2e/tests/browser/safari.test.ts— Confirms the unsupported-browser gate renders and can be bypassed in Safari, directly testing the web app shell and entry-point initialization.suite/e2e/tests/browser/ios.test.ts— Verifies the iOS unsupported-platform page renders without a bypass option, exercising platform detection and the web composition root entry path.suite/e2e/tests/bridge-tor/spawn-bridge.test.ts— Tests that the desktop app spawns and stops its bundled bridge process correctly across launch, reload, and quit, directly covering the desktop initialization and composition root.suite/e2e/tests/bridge-tor/spawn-bridge-daemon.test.ts— Exercises the desktop daemon-mode startup path where the bridge is spawned separately from the UI, directly testing the desktop init and composition root changes.suite/e2e/tests/trezor-connect/getAddress.test.ts— Validates TrezorConnect address export in suite-desktop core mode after onboarding, covering Connect initialization, permissions modal, and desktop app integration affected by the composition root and Connect logger setup.suite/e2e/tests/trezor-connect/connectPopupWeb.test.ts— Covers the web-based TrezorConnect popup lifecycle and permission/address flows, exercising the web composition root, init, and Connect integration.packages/suite/src/support/createGetBinFilesBaseUrl.tssuite/test-utils/package.jsonsuite/test-utils/src/StoreProviderForTests.tsxsuite/test-utils/src/index.tssuite/test-utils/src/initStoreForTests.tssuite/test-utils/src/renderWithStore.tsxsuite/test-utils/tsconfig.jsonUpdated: 2026-09-08T10:56:08.980Z
🌐 Preview deployments
🌐 Suite Web preview: https://dev.suite.sldev.cz/suite-web/refactor-suite-app-initialization/web/
🔍 Currents Test Results
🔍 Suite desktop test results: View in Currents
🔍 Suite web test results: View in Currents
🔒 Quarantined E2E Tests
Trezor Suite (web) — 4 test(s)
Updated: 2026-09-08T13:19:20.274Z • 4 test(s) total
Trezor Suite (desktop) — 5 test(s)
Updated: 2026-09-08T13:18:34.930Z • 5 test(s) total