Skip to content

Commit

Permalink
rename notify function
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Pader committed Jul 12, 2023
1 parent 6d6c442 commit a06fa20
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Onyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,7 @@ function evictStorageAndRetry(error, onyxMethod, ...args) {
* @param {*} value
* @param {String} method
*/
// eslint-disable-next-line rulesdir/no-negated-variables
function notifyAndWriteToCache(key, value, method) {
function broadcastUpdate(key, value, method) {
// Logging properties only since values could be sensitive things we don't want to log
Logger.logInfo(`${method}() called for key: ${key}${_.isObject(value) ? ` properties: ${_.keys(value).join(',')}` : ''}`);

Expand All @@ -876,7 +875,7 @@ function set(key, value) {
}

// We relay changes to subscribers optimistically to avoid lag (think UI updates)
notifyAndWriteToCache(key, value, 'set');
broadcastUpdate(key, value, 'set');

return Storage.setItem(key, value)
.catch(error => evictStorageAndRetry(error, set, key, value));
Expand Down Expand Up @@ -989,7 +988,7 @@ function merge(key, changes) {
const modifiedData = applyMerge([batchedChanges], existingValue);

// We relay changes to subscribers optimistically to avoid lag (think UI updates)
notifyAndWriteToCache(key, modifiedData, 'merge');
broadcastUpdate(key, modifiedData, 'merge');

return Storage.mergeItem(key, batchedChanges, modifiedData);
} catch (error) {
Expand Down

0 comments on commit a06fa20

Please sign in to comment.