From 297133c9132eccdfff01d6624965dcaeed476fa5 Mon Sep 17 00:00:00 2001 From: Nicolai Moraru Date: Sat, 27 Jul 2024 23:08:59 +0300 Subject: [PATCH] docs: add note about using provide for default store --- .../.vitepress/theme/components/VPSwitchStoreStyle.vue | 2 +- packages/private/docs/api/checkpoints/composables.md | 7 +++++++ packages/private/docs/api/store/composables.md | 7 +++++++ packages/private/docs/api/store/events.md | 7 +++++++ packages/private/docs/api/store/references.md | 7 +++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/private/docs/.vitepress/theme/components/VPSwitchStoreStyle.vue b/packages/private/docs/.vitepress/theme/components/VPSwitchStoreStyle.vue index 40860db..6b726c1 100644 --- a/packages/private/docs/.vitepress/theme/components/VPSwitchStoreStyle.vue +++ b/packages/private/docs/.vitepress/theme/components/VPSwitchStoreStyle.vue @@ -19,7 +19,7 @@ const isDefaultStoreSelected = defineModel({ :aria-checked="isDefaultStoreSelected" @click="isDefaultStoreSelected = !isDefaultStoreSelected" /> - Multiple + Argument diff --git a/packages/private/docs/api/checkpoints/composables.md b/packages/private/docs/api/checkpoints/composables.md index 236c69b..d83539e 100644 --- a/packages/private/docs/api/checkpoints/composables.md +++ b/packages/private/docs/api/checkpoints/composables.md @@ -2,6 +2,13 @@ Checkpoints composables. +
+ +> [!NOTE] +> To use these composables with the "default" [Checkpoints](https://tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/) object, you need to have the object provided with the [`provideCheckpoints`](/api/checkpoints/context#provide-checkpoints) function in a parent component. We recommend providing the store in the `createApp` call just like the `provideStore` is used in the [example in the guide](/guide/getting-started/connect-to-vuejs-app#provide-the-store-to-your-vue-app). + +
+ ## useCheckpoint {#use-checkpoint} The `useCheckpoint` composable returns the label for a checkpoint, and registers a listener so that any changes to that result will cause a re-render. diff --git a/packages/private/docs/api/store/composables.md b/packages/private/docs/api/store/composables.md index 24f3065..af3dc42 100644 --- a/packages/private/docs/api/store/composables.md +++ b/packages/private/docs/api/store/composables.md @@ -2,6 +2,13 @@ Store's composables. +
+ +> [!NOTE] +> To use these composables with the "default" store, you need to have the store provided with the [`provideStore`](/api/store/context#provide-store) function in a parent component. We recommend providing the store in the `createApp` call just like the [example in the guide](/guide/getting-started/connect-to-vuejs-app#provide-the-store-to-your-vue-app). + +
+ ## useCell {#use-cell} The `useCell` composable returns a **readonly** reference to an object containing the value of a single [Cell](https://tinybase.org/api/store/type-aliases/store/cell/) in a given [Row](https://tinybase.org/api/store/type-aliases/store/row/), in a given [Table](https://tinybase.org/api/store/type-aliases/store/table/), and registers a listener so that any changes to that result will cause a re-render. diff --git a/packages/private/docs/api/store/events.md b/packages/private/docs/api/store/events.md index 8ce60da..a8df95a 100644 --- a/packages/private/docs/api/store/events.md +++ b/packages/private/docs/api/store/events.md @@ -2,6 +2,13 @@ Store's event hooks. +
+ +> [!NOTE] +> To use these event hooks with the "default" store, you need to have the store provided with the [`provideStore`](/api/store/context#provide-store) function in a parent component. We recommend providing the store in the `createApp` call just like the [example in the guide](/guide/getting-started/connect-to-vuejs-app#provide-the-store-to-your-vue-app). + +
+ ## onCellChange {#on-cell-change} The `onCellChange` event hook registers a listener function with a [Store](https://tinybase.org/api/store/interfaces/store/store/) that will be called whenever data in a [Cell](https://tinybase.org/api/store/type-aliases/store/cell/) changes. diff --git a/packages/private/docs/api/store/references.md b/packages/private/docs/api/store/references.md index c2bfd17..c3e95ee 100644 --- a/packages/private/docs/api/store/references.md +++ b/packages/private/docs/api/store/references.md @@ -2,6 +2,13 @@ Store's references. +
+ +> [!NOTE] +> To use these references with the "default" store, you need to have the store provided with the [`provideStore`](/api/store/context#provide-store) function in a parent component. We recommend providing the store in the `createApp` call just like the [example in the guide](/guide/getting-started/connect-to-vuejs-app#provide-the-store-to-your-vue-app). + +
+ > [!IMPORTANT] > The references are not deep-reactive, you have to assign a new value to the reference when you want to update the data.