streaksheet
Advanced tools
Comparing version 0.7.21 to 0.7.22
@@ -75,2 +75,3 @@ "use strict"; | ||
var handleNewLocalRowMutation = (0, _react.useCallback)(function (mutation) { | ||
// Mutation validation | ||
if (!columnAndOverviewData.sections.some(function (section) { | ||
@@ -82,2 +83,31 @@ return section.key == mutation.sectionKey; | ||
var rowExists = false; | ||
var _iterator = _createForOfIteratorHelper(rowsBySection[mutation.sectionKey]), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var rowChunk = _step.value; | ||
var row = rowChunk.rowsResult.rows.filter(function (row) { | ||
return !row.isDeleted; | ||
}).find(function (row) { | ||
return row.key === mutation.rowKey; | ||
}); | ||
if (row) { | ||
rowExists = true; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
if (mutation.type === 'ADD' && rowExists || mutation.type === 'DELETE' && !rowExists) { | ||
return false; | ||
} | ||
setLocalRowMutations(function (localRowMutations) { | ||
@@ -117,11 +147,11 @@ return (0, _immer["default"])(localRowMutations, function (draft) { | ||
return true; | ||
}, [columnAndOverviewData.sections]); | ||
}, [columnAndOverviewData.sections, rowsBySection]); | ||
var calculatedRowsBySection = (0, _react.useMemo)(function () { | ||
return (0, _immer["default"])(rowsBySection, function (draft) { | ||
var _iterator = _createForOfIteratorHelper(localRowMutations), | ||
_step; | ||
var _iterator2 = _createForOfIteratorHelper(localRowMutations), | ||
_step2; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var mutation = _step.value; | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | ||
var mutation = _step2.value; | ||
@@ -148,5 +178,5 @@ switch (mutation.type) { | ||
} catch (err) { | ||
_iterator.e(err); | ||
_iterator2.e(err); | ||
} finally { | ||
_iterator.f(); | ||
_iterator2.f(); | ||
} | ||
@@ -166,16 +196,16 @@ }); | ||
var _iterator2 = _createForOfIteratorHelper(requests), | ||
_step2; | ||
var _iterator3 = _createForOfIteratorHelper(requests), | ||
_step3; | ||
try { | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | ||
var _request$abortControl; | ||
var request = _step2.value; | ||
var request = _step3.value; | ||
(_request$abortControl = request.abortController) === null || _request$abortControl === void 0 ? void 0 : _request$abortControl.abort(); | ||
} | ||
} catch (err) { | ||
_iterator2.e(err); | ||
_iterator3.e(err); | ||
} finally { | ||
_iterator2.f(); | ||
_iterator3.f(); | ||
} | ||
@@ -261,8 +291,8 @@ } | ||
if (sectionRowData) { | ||
var _iterator3 = _createForOfIteratorHelper(sectionRowData), | ||
_step3; | ||
var _iterator4 = _createForOfIteratorHelper(sectionRowData), | ||
_step4; | ||
try { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | ||
var rowChunk = _step3.value; | ||
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { | ||
var rowChunk = _step4.value; | ||
var row = rowChunk.rowsResult.rows.find(function (row) { | ||
@@ -277,5 +307,5 @@ return row.key === rowKey; | ||
} catch (err) { | ||
_iterator3.e(err); | ||
_iterator4.e(err); | ||
} finally { | ||
_iterator3.f(); | ||
_iterator4.f(); | ||
} | ||
@@ -305,4 +335,4 @@ } | ||
var _iterator4 = _createForOfIteratorHelper(options.dataHandlers), | ||
_step4; | ||
var _iterator5 = _createForOfIteratorHelper(options.dataHandlers), | ||
_step5; | ||
@@ -313,3 +343,3 @@ try { | ||
var dataHandler = _step4.value; | ||
var dataHandler = _step5.value; | ||
var requestTriggerRange = getSectionRowRangeFromBufferAmount((_dataHandler$requestT = dataHandler.requestTriggerDistance) !== null && _dataHandler$requestT !== void 0 ? _dataHandler$requestT : 50); | ||
@@ -429,9 +459,9 @@ var requestLimitRange = getSectionRowRangeFromBufferAmount((_dataHandler$requestL = dataHandler.requestLimitDistance) !== null && _dataHandler$requestL !== void 0 ? _dataHandler$requestL : 100); | ||
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { | ||
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { | ||
_loop(); | ||
} | ||
} catch (err) { | ||
_iterator4.e(err); | ||
_iterator5.e(err); | ||
} finally { | ||
_iterator4.f(); | ||
_iterator5.f(); | ||
} | ||
@@ -438,0 +468,0 @@ }; // This function is to be used as a hook inside of a StreakSheet instance. |
{ | ||
"name": "streaksheet", | ||
"version": "0.7.21", | ||
"version": "0.7.22", | ||
"author": "Chris Cowan <agentme49@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
441218
3886