Commit 6879f10
committed
Optimized the startup by removing redundant init
Changes Made:
1. Removed duplicate key initialization:
- Removed _initializeKeys() method from MainScreenState
- Removed the call to initialize keys in initState() since keys are already initialized in
main()
2. Removed duplicate election loading:
- Removed loadElections() call from ElectionsScreen.initState()
- Elections are already loaded in MainScreenState._loadElectionsOnStartup()
Expected Results:
After these optimizations, the app startup logs should no longer show:
- Duplicate "✅ Existing mnemonic validated successfully" messages
- Duplicate "🚀 Starting election loading process..." messages
- Duplicate "🔌 Connecting to Nostr service..." attempts
- "🔗 Connection already in progress, waiting..." warnings
The app will now:
- Initialize keys only once during main()
- Load elections only once in MainScreenState
- Connect to Nostr service without conflicts
- Start faster with cleaner logs
- Maintain all existing functionality
The optimizations eliminate redundant work while preserving the exact same user experience,
just with better performance and cleaner debug output.1 parent 16f3120 commit 6879f10
2 files changed
Lines changed: 2 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
138 | 137 | | |
139 | 138 | | |
140 | 139 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 140 | | |
149 | 141 | | |
150 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
0 commit comments