@liveblocks/react
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -276,6 +276,33 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const items = sortedListItems(getListItems(this._cache, id)); | ||
const [itemPosition, item] = items[index]; | ||
const afterPosition = items[targetIndex][0]; | ||
const beforePosition = targetIndex === 0 ? undefined : items[targetIndex - 1][0]; | ||
if (targetIndex < 0) { | ||
throw new Error("targetIndex cannont be less than 0"); | ||
} | ||
if (targetIndex >= items.length) { | ||
throw new Error("targetIndex cannot be greater or equal than the list length"); | ||
} | ||
if (index < 0) { | ||
throw new Error("index cannont be less than 0"); | ||
} | ||
if (index >= items.length) { | ||
throw new Error("index cannot be greater or equal than the list length"); | ||
} | ||
if (index === targetIndex) { | ||
return this; | ||
} | ||
let beforePosition = null; | ||
let afterPosition = null; | ||
if (index < targetIndex) { | ||
afterPosition = | ||
targetIndex === items.length - 1 | ||
? undefined | ||
: items[targetIndex + 1][0]; | ||
beforePosition = items[targetIndex][0]; | ||
} | ||
else { | ||
afterPosition = items[targetIndex][0]; | ||
beforePosition = | ||
targetIndex === 0 ? undefined : items[targetIndex - 1][0]; | ||
} | ||
const position = makePosition(beforePosition, afterPosition); | ||
const [, item] = items[index]; | ||
return this.dispatch({ | ||
@@ -512,6 +539,6 @@ type: OpType.ListMove, | ||
function isRecord(value) { | ||
return typeof value === "object" && value.$$type === RECORD; | ||
return value != null && typeof value === "object" && value.$$type === RECORD; | ||
} | ||
function isList(value) { | ||
return typeof value === "object" && value.$$type === LIST; | ||
return value != null && typeof value === "object" && value.$$type === LIST; | ||
} | ||
@@ -518,0 +545,0 @@ function isCrdt(value) { |
{ | ||
"name": "@liveblocks/react", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "", | ||
@@ -16,3 +16,3 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@liveblocks/client": "0.7.0" | ||
"@liveblocks/client": "0.7.1" | ||
}, | ||
@@ -19,0 +19,0 @@ "peerDependencies": { |
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
171072
1722
+ Added@liveblocks/client@0.7.1(transitive)
- Removed@liveblocks/client@0.7.0(transitive)
Updated@liveblocks/client@0.7.1