Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 446b449

Browse files
committed
Fix debounce usage in FirebaseObject
A new debounced function was being created on every call to `scopeUpdated()`. That's probably not what we want. Instead create it once and call the same instance on every update.
1 parent 6ed1fc1 commit 446b449

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/FirebaseObject.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,12 @@
334334
parsed.assign(scope, $firebaseUtils.scopeData(rec));
335335
}
336336

337+
var send = $firebaseUtils.debounce(function() {
338+
rec.$$scopeUpdated(getScope())
339+
['finally'](function() { sending = false; });
340+
}, 50, 500);
341+
337342
var scopeUpdated = function() {
338-
var send = $firebaseUtils.debounce(function() {
339-
rec.$$scopeUpdated(getScope())
340-
['finally'](function() { sending = false; });
341-
}, 50, 500);
342343
if( !equals(rec) ) {
343344
sending = true;
344345
send();

0 commit comments

Comments
 (0)