File tree 1 file changed +6
-2
lines changed
src/screens/home/displays
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,12 @@ export function DisplayView() {
168
168
const changes = diffGamepadStates ( lastStates , states ) ;
169
169
170
170
if ( changes . length > 0 ) {
171
+ // NOTE: It is important that we assign lastStates before any await
172
+ // points to avoid having later iterations of the polling loop
173
+ // interleave and potentially firing duplicate events, see
174
+ // https://github.com/ProjectLighthouseCAU/luna/issues/89
175
+ lastStates = states ;
176
+
171
177
if ( inputConfig . legacyMode ) {
172
178
// Convert and send events to the legacy API
173
179
const legacyEvents : LegacyControllerEvent [ ] = changes
@@ -209,8 +215,6 @@ export function DisplayView() {
209
215
} ) ) ;
210
216
}
211
217
}
212
-
213
- lastStates = states ;
214
218
}
215
219
} , 10 ) ;
216
220
console . log ( 'Registered gamepad polling loop' , interval ) ;
You can’t perform that action at this time.
0 commit comments