Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/follow-redirects-1…
Browse files Browse the repository at this point in the history
….15.4
  • Loading branch information
pozil authored Jan 12, 2024
2 parents 9946f09 + da91cc5 commit f8a1267
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The lookup can return default search results with the `setDefaultResults(results

Here's how you can retrieve recent records and set them as default search results:

1. Implement an Apex endpoint that returns the recent records:
1. Implement an Apex endpoint that returns the recent records:

```apex
@AuraEnabled(cacheable=true scope='global')
Expand All @@ -175,13 +175,13 @@ Here's how you can retrieve recent records and set them as default search result

See the [full code from the sample app](/src-sample/main/default/classes/SampleLookupController.cls#L59)

1. In your parent component, create a property that holds the default results:
1. In your parent component, create a property that holds the default results:

```js
recentlyViewed = [];
```

1. Write a utility function that sets your default search results:
1. Write a utility function that sets your default search results:

```js
initLookupDefaultResults() {
Expand All @@ -193,7 +193,7 @@ Here's how you can retrieve recent records and set them as default search result
}
```

1. Retrieve the recent records by calling your endpoint:
1. Retrieve the recent records by calling your endpoint:

```js
@wire(getRecentlyViewed)
Expand All @@ -205,15 +205,15 @@ Here's how you can retrieve recent records and set them as default search result
}
```

1. Initialize the lookup default results when the parent component loads:
1. Initialize the lookup default results when the parent component loads:

```js
connectedCallback() {
this.initLookupDefaultResults();
}
```
```js
connectedCallback() {
this.initLookupDefaultResults();
}
```

**Note:** `initLookupDefaultResults()` is called in two places because the wire could load before the lookup is rendered.
> [!NOTE] > `initLookupDefaultResults()` is called in two places because the wire could load before the lookup is rendered.

### Saving form state when creating new records (optional)

Expand Down Expand Up @@ -245,7 +245,8 @@ connectedCallback() {
}
```

**Tip:** consider working with cookies to store information in a temporary state.
> [!TIP]
> Consider working with cookies to store information in a temporary state with an expiry date.

### Passing custom data to JavaScript and Apex (optional)

Expand Down

0 comments on commit f8a1267

Please sign in to comment.