Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where dwn-store records are not actually being updated #961

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/agent/src/store-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = Jwk> implem

// set the recordId in the messageParams to update the existing record
// set the dateCreated to the existing dateCreated as this is an immutable property
messageParams.recordId = matchingRecordEntry.recordsWrite?.recordId;
messageParams.dateCreated = matchingRecordEntry.recordsWrite?.descriptor.dateCreated;
messageParams.recordId = matchingRecordEntry.recordsWrite!.recordId;
messageParams.dateCreated = matchingRecordEntry.recordsWrite!.descriptor.dateCreated;
LiranCohen marked this conversation as resolved.
Show resolved Hide resolved
} else if (preventDuplicates) {
// Look up the DWN record ID of the object in the store with the given `id`.
const matchingRecordId = await this.lookupRecordId({ id, tenantDid, agent });
Expand Down Expand Up @@ -326,10 +326,6 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = Jwk> implem
messageParams : { filter: { recordId } }
});

if (readReply.status.code !== 200 || !readReply.entry) {
throw new Error(`${this.name}: Failed to read data from DWN for: ${recordId}`);
}

return readReply.entry;
}
}
Expand Down
Loading