Skip to content

Commit

Permalink
Tests, translations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejewsky committed Jan 17, 2025
1 parent ec2927e commit 07ab80c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const keepProductOrder =
(listElements: string[], products: CollectionProducts) => (position: number) => {
const orderedProducts = products.edges
.map(edge => edge.node.id)
.map(nodeId => listElements.find(id => nodeId == id))
.map(nodeId => listElements.find(id => nodeId == id) || "")
.filter(Boolean);

if (position < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ export const useProductReorderOptimistic = () => {
const shifted = shift(productIds, -shiftOffset);

const exceededEdges = shifted.map(edge => {
const isExceededId = exceededProductIds.includes(edge.node.id);
const newId = isExceededId ? "optimistic_" + edge.node.id : edge.node.id;
const nodeId = edge?.node?.id || "";
const isExceededId = exceededProductIds.includes(nodeId);
const newId = isExceededId ? "optimistic_" + nodeId : nodeId;

return {
...edge,
node: {
...edge.node,
...edge?.node,
id: newId,
},
};
Expand Down

0 comments on commit 07ab80c

Please sign in to comment.