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

Update some docs to string ids #9378

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
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
24 changes: 12 additions & 12 deletions packages/store/src/-private/store-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ class Store extends EmberObject {
To create a new instance of a `Post` that has a relationship with a `User` record:

```js
let user = this.store.peekRecord('user', 1);
let user = this.store.peekRecord('user', '1');
store.createRecord('post', {
title: 'Ember is awesome!',
user: user
Expand Down Expand Up @@ -806,7 +806,7 @@ class Store extends EmberObject {
Example

```javascript
store.findRecord('post', 1).then(function(post) {
store.findRecord('post', '1').then(function(post) {
store.unloadRecord(post);
});
```
Expand Down Expand Up @@ -953,8 +953,8 @@ class Store extends EmberObject {
If you have access to the post model you can also pass the model itself to preload:

```javascript
let post = await store.findRecord('post', 1);
let comment = await store.findRecord('comment', 2, { post: myPostModel });
let post = await store.findRecord('post', '1');
let comment = await store.findRecord('comment', '2', { post: myPostModel });
```

### Reloading
Expand Down Expand Up @@ -983,7 +983,7 @@ class Store extends EmberObject {
// revision: 2
// }
// ]
store.findRecord('post', 1, { reload: true }).then(function(post) {
store.findRecord('post', '1', { reload: true }).then(function(post) {
post.revision; // 2
});
```
Expand Down Expand Up @@ -1021,7 +1021,7 @@ class Store extends EmberObject {
}
});

let blogPost = store.findRecord('post', 1).then(function(post) {
let blogPost = store.findRecord('post', '1').then(function(post) {
post.revision; // 1
});

Expand Down Expand Up @@ -1260,7 +1260,7 @@ class Store extends EmberObject {
Example

```javascript
let userRef = store.getReference('user', 1);
let userRef = store.getReference('user', '1');

// check if the user is loaded
let isLoaded = userRef.value() !== null;
Expand Down Expand Up @@ -1331,9 +1331,9 @@ class Store extends EmberObject {
**Example 1**

```js
let post = store.peekRecord('post', 1);
let post = store.peekRecord('post', '1');

post.id; // 1
post.id; // '1'
```

`peekRecord` can be called with a single identifier argument instead of the combination
Expand All @@ -1344,7 +1344,7 @@ class Store extends EmberObject {

```js
let post = store.peekRecord({ type: 'post', id });
post.id; // 1
post.id; // '1'
```

If you have previously received an lid from an Identifier for this record, you can lookup the record again using
Expand All @@ -1354,7 +1354,7 @@ class Store extends EmberObject {

```js
let post = store.peekRecord({ lid });
post.id; // 1
post.id; // '1'
```


Expand Down Expand Up @@ -1426,7 +1426,7 @@ class Store extends EmberObject {
If you do something like this:

```javascript
store.query('person', { ids: [1, 2, 3] });
store.query('person', { ids: ['1', '2', '3'] });
```

The request made to the server will look something like this:
Expand Down
Loading