Skip to content

Commit

Permalink
docs: add optional and required flag to props in react docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SewerynKras committed Oct 6, 2023
1 parent a9df599 commit e547dfc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/pages/docs/creators/javascript/react/use-debit-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ type: reference

This hook accepts a single configuration object with the following properties:

| Name | Description |
| --------- | ------------------------------------------------------------------- |
| limit | The maximum number of debit notes to fetch. Defaults to 10. |
| swrConfig | [SWR configuration object](https://swr.vercel.app/docs/api#options) |
| Name | Description |
| -------------------- | ------------------------------------------------------------------- |
| limit (optional) | The maximum number of debit notes to fetch. Defaults to 10. |
| swrConfig (optional) | [SWR configuration object](https://swr.vercel.app/docs/api#options) |

Please note that the hook doesn't support pagination. The debit notes are always sorted from newest to oldest and to fetch earlier debit notes you need to set the `limit` to a higher value.

Expand Down
14 changes: 10 additions & 4 deletions src/pages/docs/creators/javascript/react/use-executor.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ type: reference

The hook accepts two configuration objects, one for the executor itself (package, demand specification, budget, etc) and one for the extra behavior (e.g. whether to add a `beforeunload` event listener to prevent the user from accidentally closing the tab while the executor is running).

| Name | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options | [ExecutorOptions](/docs/golem-js/reference/modules/executor_executor#executoroptionsmixin) |
| extraOptions | - `addBeforeUnloadHandler` - Boolean indicating whether to add a `beforeunload` event listener to prevent the user from accidentally closing the tab while the executor is running. Defaults to `true`. |
| Name | Description |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| options (required) | [ExecutorOptions](/docs/golem-js/reference/modules/executor_executor#executoroptionsmixin) |
| extraOptions (optional) | See below |

### Extra options

| Name | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| addBeforeUnloadHandler (optional) | Boolean indicating whether to add a `beforeunload` event listener to prevent the user from closing the tab while the executor is running. Defaults to `true`. |

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ type: reference

This hook accepts two props:

| Name | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| debitNote (required) | The id of the debit note to handle (you can get it from the [useDebitNotes](/docs/creators/javascript/react/use-debit-notes) hook). |
| options (optional) | see below |
| allocationTimeoutMs | The timeout for the allocation in milliseconds. Defaults to 60 seconds. |
| Name | Description |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| debitNote (required) | The id of the debit note to handle (you can get it from the [useDebitNotes](/docs/creators/javascript/react/use-debit-notes) hook). |
| options (optional) | see below |
| allocationTimeoutMs (optional) | The timeout for the allocation in milliseconds. Defaults to 60 seconds. |

### Options

Expand Down
10 changes: 5 additions & 5 deletions src/pages/docs/creators/javascript/react/use-invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ type: reference

This hook accepts a single configuration object with the following properties:

| Name | Description |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| after | A string representing the timestamp to start fetching invoices from. If not provided, the hook will fetch invoices starting from the earliest invoice known to the connected yagna instance. |
| limit | The maximum number of invoices to fetch. Defaults to 10. |
| swrConfig | [SWR configuration object](https://swr.vercel.app/docs/api#options) |
| Name | Description |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| after (optional) | A string representing the timestamp to start fetching invoices from. If not provided, the hook will fetch invoices starting from the earliest invoice known to the connected yagna instance. |
| limit (optional) | The maximum number of invoices to fetch. Defaults to 10. |
| swrConfig (optional) | [SWR configuration object](https://swr.vercel.app/docs/api#options) |

To achieve pagination, pass the `timestamp` of the last invoice in the `after` parameter of the next call.

Expand Down
6 changes: 3 additions & 3 deletions src/pages/docs/creators/javascript/react/use-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type: reference

This hook takes the [TaskExecutor](/docs/golem-js/reference/classes/executor_executor.TaskExecutor) instance, initialized by the [useExecutor](/docs/creators/javascript/react/use-executor) hook.

| Name | Description |
| -------- | --------------------------------------------------------------------------------------------- |
| executor | The [TaskExecutor](/docs/golem-js/reference/classes/executor_executor.TaskExecutor) instance. |
| Name | Description |
| ------------------- | --------------------------------------------------------------------------------------------- |
| executor (required) | The [TaskExecutor](/docs/golem-js/reference/classes/executor_executor.TaskExecutor) instance. |

## Example

Expand Down

0 comments on commit e547dfc

Please sign in to comment.