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

[BUGFIX release] restore unloadRecord + createRecord #5097

Merged
merged 1 commit into from
Jul 27, 2017

Conversation

stefanpenner
Copy link
Member

The following should be possible:

const record = store.find(‘record’, 1);
record.unloadRecord();
store.createRecord(‘record’, 1);

before this commit, the createRecord would fail,
as the record would not yet be fully unloaded,
and its ID would still be reserved.

@stefanpenner stefanpenner requested a review from hjdivad July 27, 2017 19:35
Copy link
Member

@hjdivad hjdivad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


assert(`The id ${id} has already been used with another record for modelClass '${modelName}'.`, !id || !recordMap.get(id));
if (existingInternalModel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned this in chat, but I think this should be if (existingInternalModel && existingInternalModel._isDematerializing) { (otherwise we destroy everything and the assert just below is useless).

@stefanpenner stefanpenner force-pushed the release-unload-and-create branch from edf2453 to bfa5d26 Compare July 27, 2017 19:44
@rwjblue
Copy link
Member

rwjblue commented Jul 27, 2017

👍 LGTM

The following should be possible:

```js
const record = store.find(‘record’, 1);
record.unloadRecord();
store.createRecord(‘record’, 1);
```

before this commit, the `createRecord` would fail,
as the `record` would not yet be fully unloaded, 
and its ID would still be reserved.
@stefanpenner stefanpenner force-pushed the release-unload-and-create branch from bfa5d26 to 22d84ca Compare July 27, 2017 19:54
@stefanpenner stefanpenner merged commit bb3c60b into release Jul 27, 2017
@stefanpenner stefanpenner deleted the release-unload-and-create branch July 27, 2017 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants