Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix too many useless angular detection changes

Chocobozzzb6dd0166016a
diff --git a/client/src/app/core/hotkeys/hotkeys.service.ts b/client/src/app/core/hotkeys/hotkeys.service.ts
index 9e0f5a70b7..9db8c9512a 100644
--- a/client/src/app/core/hotkeys/hotkeys.service.ts
+++ b/client/src/app/core/hotkeys/hotkeys.service.ts
@@ -1,6 +1,6 @@
// Thanks to https://github.com/brtnshrdr/angular2-hotkeys
-import { Injectable } from '@angular/core'
+import { Injectable, NgZone } from '@angular/core'
import { Hotkey } from './hotkey.model'
import { Subject } from 'rxjs'
import { tinykeys } from 'tinykeys'
@@ -19,7 +19,7 @@ export class HotkeysService {
private removeTinyKeysStore = new Map<Hotkey, (() => void)[]>()
- constructor () {
+ constructor (private zone: NgZone) {
this.initCheatSheet()
}
@@ -54,31 +54,33 @@ export class HotkeysService {
for (const combo of hotkey.combo) {
debugLogger('Adding hotkey ' + hotkey.formatted)
- const removeTinyKey = tinykeys(window, {
- [combo]: event => {
- if (this.disabled) return
+ this.zone.runOutsideAngular(() => {
+ const removeTinyKey = tinykeys(window, {
+ [combo]: event => {
+ if (this.disabled) return
- const target = event.target as Element
- const nodeName: string = target.nodeName.toUpperCase()
+ const target = event.target as Element
+ const nodeName: string = target.nodeName.toUpperCase()
- if (this.preventIn.includes(nodeName)) {
- return
- }
+ if (this.preventIn.includes(nodeName)) {
+ return
+ }
- const result = hotkey.callback.apply(this, [ event, combo ])
+ const result = hotkey.callback.apply(this, [ event, combo ])
- if (result === false) {
- event.preventDefault()
- event.stopPropagation()
+ if (result === false) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
}
- }
- })
+ })
- if (!this.removeTinyKeysStore.has(hotkey)) {
- this.removeTinyKeysStore.set(hotkey, [])
- }
+ if (!this.removeTinyKeysStore.has(hotkey)) {
+ this.removeTinyKeysStore.set(hotkey, [])
+ }
- this.removeTinyKeysStore.get(hotkey).push(removeTinyKey)
+ this.removeTinyKeysStore.get(hotkey).push(removeTinyKey)
+ })
}
return hotkey
diff --git a/client/src/app/helpers/rxjs.ts b/client/src/app/helpers/rxjs.ts
index 2eaf0a0554..f27ff935c1 100644
--- a/client/src/app/helpers/rxjs.ts
+++ b/client/src/app/helpers/rxjs.ts
@@ -1,6 +1,6 @@
import { uniq } from 'lodash-es'
-import { Observable } from 'rxjs'
-import { bufferTime, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators'
+import { Observable, timer } from 'rxjs'
+import { buffer, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators'
function buildBulkObservable <P extends number | string, R> (options: {
notifierObservable: Observable<P>
@@ -11,7 +11,7 @@ function buildBulkObservable <P extends number | string, R> (options: {
return notifierObservable.pipe(
distinctUntilChanged(),
- bufferTime(time),
+ buffer(timer(time)),
filter(params => params.length !== 0),
map(params => uniq(params)),
switchMap(params => {
diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts
index 53ec58d081..c767331722 100644
--- a/client/src/app/shared/shared-search/find-in-bulk.service.ts
+++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts
@@ -136,7 +136,7 @@ export class FindInBulkService {
notifier,
result: buildBulkObservable({
- time: 500,
+ time: 100,
bulkGet,
notifierObservable: notifier.asObservable()
})