Skip to content

Commit

Permalink
[BUGFIX BETA CANARY] usage of recordDataFor for client side create ne…
Browse files Browse the repository at this point in the history
…eds to be in correct cache (#6334)

* [BUGFIX BETA CANARY] allow creation via recordDataFor

* [BUGFIX BETA CANARY] usage of recordDataFor for client side create needs to be in correct cache

(cherry picked from commit 2dff029)
  • Loading branch information
runspired authored and lambda beta bot committed Aug 16, 2019
1 parent f15d0ef commit 34bff44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 7 additions & 5 deletions packages/store/addon/-private/system/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2921,13 +2921,15 @@ class Store extends Service {
}
}

recordDataFor(modelName: string, id: string, clientId?: string | null): RecordData;
recordDataFor(modelName: string, id: string | null, clientId: string): RecordData;
recordDataFor(modelName: string, id: string | null, clientId?: string | null): RecordData {
recordDataFor(modelName: string, id?: string | null, clientId?: string | null): RecordData {
let internalModel: InternalModel;

if (!hasValidId(id, clientId)) {
throw new Error(`Expected either id or clientId to be valid id`);
internalModel = internalModelFactoryFor(this).build(modelName, null);
} else {
internalModel = internalModelFactoryFor(this).lookup(modelName, id, clientId);
}
let internalModel = internalModelFactoryFor(this).lookup(modelName, id, clientId);

return recordDataFor(internalModel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,10 @@ export default class RecordDataStoreWrapper implements IRecordDataStoreWrapper {
}
}

recordDataFor(modelName: string, id: string, clientId?: string | null): RecordData;
recordDataFor(modelName: string, id: string | null, clientId: string): RecordData;
recordDataFor(modelName: string, id: string, clientId: string | null | undefined): RecordData;
recordDataFor(modelName: string, id: string | null, clientId: string | null | undefined): RecordData {
if (!hasValidId(id, clientId)) {
throw new Error(MISSING_ID_ARG_ERROR_MESSAGE);
}

recordDataFor(modelName: string): RecordData;
recordDataFor(modelName: string, id?: string | null, clientId?: string | null): RecordData {
return this._store.recordDataFor(modelName, id, clientId);
}

Expand Down

0 comments on commit 34bff44

Please sign in to comment.