The webflow.updateItem(...) method introduced a spread operation in the arguments that makes it behavior differently (and unnecessary) from other methods on the object.
The documentation (READme.md) specifies that both the updateItem and createItem methods can be used like so:
// Create a new item
await webflow.createItem({
collectionId,
fields,
});
// Update an item
await webflow.updateItem({
collectionId,
itemId,
fields,
});
However, the updateItem function doesn't work like this, as the method uses a spread operator and thus expects all fields to be at the top level of the passed object:
Hi!
The
webflow.updateItem(...)
method introduced a spread operation in the arguments that makes it behavior differently (and unnecessary) from other methods on the object.The documentation (READme.md) specifies that both the
updateItem
andcreateItem
methods can be used like so:However, the
updateItem
function doesn't work like this, as the method uses a spread operator and thus expects all fields to be at the top level of the passed object:This means that in order to use the method, you must use the following patter:
This is a little awkward...and could be improved in the future by making a breaking change in the next major version bump.
In the meantime, updating the docs should help 👍