Skip to content

Commit 3c6e0fe

Browse files
committed
Create/Update item adjustments
1 parent 96c1f3c commit 3c6e0fe

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

components/webflow_v2/actions/create-collection-item/create-collection-item.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default {
3232
}
3333
const { fields } = await this.app.getCollection(this.collectionId);
3434
for (const field of fields) {
35-
if (field.editable && field.slug !== "isArchived" && field.slug !== "isDraft") {
35+
if (field.isEditable && field.slug !== "isArchived" && field.slug !== "isDraft") {
3636
props[field.slug] = {
3737
type: "string",
3838
label: field.name,
@@ -41,7 +41,7 @@ export default {
4141
: field.slug === "slug"
4242
? "URL structure of the Item in your site."
4343
: "See the documentation for additional information about [Field Types & Item Values](https://developers.webflow.com/reference/field-types-item-values).",
44-
optional: !field.required,
44+
optional: !field.isRequired,
4545
};
4646
}
4747
}

components/webflow_v2/actions/update-collection-item/update-collection-item.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default {
2323
siteId: c.siteId,
2424
}),
2525
],
26-
reloadProps: true,
2726
},
2827
itemId: {
2928
propDefinition: [
@@ -33,6 +32,7 @@ export default {
3332
collectionId: c.collectionId,
3433
}),
3534
],
35+
reloadProps: true,
3636
},
3737
},
3838
async additionalProps() {
@@ -43,7 +43,7 @@ export default {
4343
const { fields } = await this.app.getCollection(this.collectionId);
4444
for (const field of fields) {
4545
if (
46-
field.editable &&
46+
field.isEditable &&
4747
field.slug !== "isArchived" &&
4848
field.slug !== "isDraft"
4949
) {
@@ -78,12 +78,13 @@ export default {
7878
const item = await app.getCollectionItem(collectionId, itemId);
7979

8080
const response = await app.updateCollectionItem(collectionId, itemId, {
81+
id: itemId,
8182
isArchived: false,
8283
isDraft: false,
8384
fieldData: {
8485
...customFields,
85-
name: name || item.name,
86-
slug: slug || item.slug,
86+
name: name || item.fieldData.name,
87+
slug: slug || item.fieldData.slug,
8788
},
8889
});
8990

0 commit comments

Comments
 (0)