Skip to content

Commit 008756c

Browse files
committed
update keepalive docs
1 parent 57881d5 commit 008756c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/primitives/KeepAlive.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ export function browsePreload(props) {
5555

5656
Note that the createMemo will be recalculated when you navigate away as params will change / are reactive. Make sure you don't update your response in those instances or the page will be updated.
5757

58+
### Removing Cached Components
59+
60+
You can manually remove a cached component using the `removeKeepAlive` function. This allows you to clear the cache for a specific route or component programmatically.
61+
62+
```js
63+
import { removeKeepAlive } from '@lightningtv/solid';
64+
65+
// Remove the cached component with the id 'browse'
66+
removeKeepAlive('browse');
67+
```
68+
5869
## API
5970

6071
### `<KeepAliveRoute>`
@@ -83,3 +94,13 @@ A component that caches its children. `<KeepAliveRoute>` uses this component int
8394
| `onRemove` | `ElementNode['onRemove']` | Custom `onRemove` transition for the wrapper view. Defaults to `alpha = 0`. |
8495
| `onRender` | `ElementNode['onRender']` | Custom `onRender` transition for the wrapper view. Defaults to `alpha = 1`. |
8596
| `transition` | `ElementNode['transition']` | Custom `transition` for the wrapper view. Defaults to `{ alpha: true }`. |
97+
98+
### Functions
99+
100+
#### `removeKeepAlive`
101+
102+
```ts
103+
function removeKeepAlive(id: string): void;
104+
```
105+
106+
Manually removes a cached component by its ID.

0 commit comments

Comments
 (0)