@decathlon/moon
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -68,16 +68,23 @@ "use strict"; | ||
this.setQueryState = function (queryId, queryState) { | ||
var currentQuery = _this.queries[queryId] || exports.getDefaultQuery(queryId); | ||
var query = _this.queries[queryId]; | ||
var currentQuery = query || exports.getDefaultQuery(queryId); | ||
var newState = __assign(__assign({}, currentQuery.state), queryState); | ||
if (!shallow_equal_1.default(newState, currentQuery.state)) { | ||
var updateStateHandlers = !shallow_equal_1.default(newState, currentQuery.state); | ||
var updateDataHandlers = updateStateHandlers && !shallow_equal_1.default(newState.data, currentQuery.state.data); | ||
if (updateStateHandlers) { | ||
currentQuery.state = newState; | ||
_this.queries[queryId] = currentQuery; | ||
var state_1 = currentQuery.state, data_1 = currentQuery.state.data; | ||
currentQuery.onStateChangeHandlers.forEach(function (onStateChangeHandler) { | ||
onStateChangeHandler(queryId, newState); | ||
onStateChangeHandler(queryId, state_1); | ||
}); | ||
if (!shallow_equal_1.default(newState.data, currentQuery.state.data)) { | ||
if (updateDataHandlers) { | ||
currentQuery.onResultChangeHandlers.forEach(function (onResultChangeHandler) { | ||
onResultChangeHandler(queryId, newState.data); | ||
onResultChangeHandler(queryId, data_1); | ||
}); | ||
} | ||
currentQuery.state = newState; | ||
} | ||
_this.queries[queryId] = currentQuery; | ||
else if (!query) { | ||
_this.queries[queryId] = currentQuery; | ||
} | ||
}; | ||
@@ -84,0 +91,0 @@ this.writeQuery = function (queryId, data) { |
{ | ||
"name": "@decathlon/moon", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "A featured, production ready caching REST client for every React UI", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
103091
1175