Skip to content

Commit

Permalink
Remove content item data keys that are no longer valid when item is b…
Browse files Browse the repository at this point in the history
…eing created (#2444)
  • Loading branch information
agalin920 authored Jan 17, 2024
1 parent 4195a2d commit af3e869
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/shell/store/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ export function createItem(modelZUID, itemZUID) {
// Temp timestamp for sorting
delete item.meta.createdAt;

// Remove content item data keys that are not in the fields list, this handles the case where a field is deleted/renamed from the model while the item is being created
Object.keys(item.data).forEach((key) => {
if (!fields.find((field) => field.name === key)) {
delete item.data[key];
}
});

// cover cases where the creating user zuid is missing
if (!item.meta.createdByUserZUID) {
item.meta.createdByUserZUID = state.user.user_zuid;
Expand Down

0 comments on commit af3e869

Please sign in to comment.