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

docs: fix links #1359

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A query REPL platform application is also available at `./examples/query-playgro

Running `yarn build` at root will automatically update the example app's copy, and running `yarn start` will build the runtime and then start the example.

A [`DHIS2 App Platform`](https://platform.dhis2.nu) example is available at [./examples/query-playground](./examples/query-playground). This is a full, deployable DHIS2 application and a live standalone version is available at [runtime.dhis2.nu/playground](https://runtime.dhis2.nu/playground)
A [`DHIS2 App Platform`](https://platform.dhis2.nu) example is available at [./examples/query-playground](./examples/query-playground). This is a full, deployable DHIS2 application and a live standalone version is available at [every play instance](https://play.dhis2.org), such as the `dev` instance [play.dhis2.org/dev](https://play.dhis2.org/dev/api/apps/query-playground/index.html).

## Release

Expand Down
4 changes: 2 additions & 2 deletions docs/advanced/offline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

!> **WARNING** These features are considered **experimental** and are **subject to breaking changes outside of the normal release cycle.**

The app platform provides some support for PWA features, including a `manifest.json` file for installability and service worker which can provide offline caching. In addition to those features, the app runtime provides support for ["cacheable sections"](advanced/offline/CacheableSections), which are sections of an app that can be individually cached on-demand. The [`useCacheableSection` hook](advanced/offline/CacheableSections#usecacheablesection-api) and the [`CacheableSection` component](advanced/offline/CacheableSections#cacheablesection-api) provide the controls for the section and the wrapper for the section, respectively. The [`useCachedSections` hook](advanced/offline/CacheableSections#usecachedsections-api) returns a list of sections that are stored in the cache and a function that can delete them.
The app platform provides some support for PWA features, including a `manifest.json` file for installability and service worker which can provide offline caching. In addition to those features, the app runtime provides support for ["cacheable sections"](./CacheableSections.md), which are sections of an app that can be individually cached on-demand. The [`useCacheableSection` hook](./CacheableSections.md#usecacheablesection-api) and the [`CacheableSection` component](./CacheableSections.md#cacheablesection-api) provide the controls for the section and the wrapper for the section, respectively. The [`useCachedSections` hook](./CacheableSections.md#usecachedsections-api) returns a list of sections that are stored in the cache and a function that can delete them.

An important tool for offline-capable apps is the [`useDhis2ConnectionStatus` hook](advanced/offline/useDhis2ConnectionStatus.md), which can be used to determine whether or not the app can connect to the DHIS2 server. There is also a [`useOnlineStatus` hook](advanced/offline/useOnlineStatus.md) which returns whether or not the client is connected to the internet, but `useDhis2ConnectionStatus` is probably the one you want to use. On instances where DHIS2 is deployed locally in an environment without internet, `useOnlineStatus` can cause problems, because it will always return `false` even though the app can communicate with the DHIS2 server and therefore function just fine. `useDhis2ConnectionStatus` was created to address this problem.
An important tool for offline-capable apps is the [`useDhis2ConnectionStatus` hook](./useDhis2ConnectionStatus.md), which can be used to determine whether or not the app can connect to the DHIS2 server. There is also a [`useOnlineStatus` hook](./useOnlineStatus.md) which returns whether or not the client is connected to the internet, but `useDhis2ConnectionStatus` is probably the one you want to use. On instances where DHIS2 is deployed locally in an environment without internet, `useOnlineStatus` can cause problems, because it will always return `false` even though the app can communicate with the DHIS2 server and therefore function just fine. `useDhis2ConnectionStatus` was created to address this problem.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/offline/useOnlineStatus.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# useOnlineStatus

!> This hook only detects whether or not you're connected to the internet, which could be problematic for DHIS2 instances that are hosted locally or offline, where what really matters is whether or not you can communicate with the DHIS2 server. The [`useDhis2ConnectionStatus` hook](advanced/offline/useDhis2ConnectionStatus) is usually better for that reason, and is therefore recommended.
!> This hook only detects whether or not you're connected to the internet, which could be problematic for DHIS2 instances that are hosted locally or offline, where what really matters is whether or not you can communicate with the DHIS2 server. The [`useDhis2ConnectionStatus` hook](./useDhis2ConnectionStatus.md) is usually better for that reason, and is therefore recommended.

The `useOnlineStatus` returns whether the client is online or offline. It debounces the returned values by default to prevent rapid changes of any UI elements that depend on the online status.

Expand Down
30 changes: 15 additions & 15 deletions docs/components/DataMutation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DataMutation Component

A thin wrapper around the [useDataMutation](hooks/useDataMutation.md) hook
A thin wrapper around the [useDataMutation](../hooks/useDataMutation.md) hook

## Basic Usage

Expand All @@ -19,13 +19,13 @@ return (

## Input Props

| Name | Type | Required | Description |
| :------------: | :-----------------------------: | :----------: | ----------------------------------------------------------------------------------------------------------------------------- |
| **mutation** | [_Mutation_](types/Mutation.md) | **required** | The Mutation definition describing the requested operation |
| **variables** | _Object_ | | Variables to be passed to the dynamic portions of the mutation |
| **onComplete** | _Function_ | | Callback function to be called on successfull completion of the mutation. Called with the response data as the only argument. |
| **onError** | _Function_ | | Callback function to be called on failure of the mutation. Called with the error instance as the only argument. |
| **lazy** | _boolean_ | | If false, run the mutation immediately after the component mounts.<br/>_**Default**: `true`_ |
| Name | Type | Required | Description |
| :------------: | :--------------------------------: | :----------: | ----------------------------------------------------------------------------------------------------------------------------- |
| **mutation** | [_Mutation_](../types/Mutation.md) | **required** | The Mutation definition describing the requested operation |
| **variables** | _Object_ | | Variables to be passed to the dynamic portions of the mutation |
| **onComplete** | _Function_ | | Callback function to be called on successfull completion of the mutation. Called with the response data as the only argument. |
| **onError** | _Function_ | | Callback function to be called on failure of the mutation. Called with the error instance as the only argument. |
| **lazy** | _boolean_ | | If false, run the mutation immediately after the component mounts.<br/>_**Default**: `true`_ |

## Render Function Props

Expand All @@ -34,13 +34,13 @@ The render function is called whenever the state of the mutation changes. It is
1. `mutate` - a function which can be called to trigger the mutation (for instance in an onClick callback)
2. `state` - an object containing the following properties:

| Name | Type | Description |
| :---------: | :-------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **called** | _boolean_ | **true** if the mutation has been triggered through a call to the `mutate` function or on component mount with `lazy: false` |
| **loading** | _boolean_ | **true** if the data is not yet available and no error has yet been encountered |
| **error** | _Error_<br/>or<br/>_undefined_ | **undefined** if no error has occurred, otherwise the Error which was thrown |
| **data** | _MutationResult_<br/>or<br/>_undefined_ | **undefined** if the data is loading or an error has occurred, otherwise a map from the name of each **QueryDefinition** defined in the **Query** to the resulting data for that query |
| **engine** | [_Data Engine_](advanced/DataEngine) | A reference to the DataEngine instance |
| Name | Type | Description |
| :---------: | :----------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **called** | _boolean_ | **true** if the mutation has been triggered through a call to the `mutate` function or on component mount with `lazy: false` |
| **loading** | _boolean_ | **true** if the data is not yet available and no error has yet been encountered |
| **error** | _Error_<br/>or<br/>_undefined_ | **undefined** if no error has occurred, otherwise the Error which was thrown |
| **data** | _MutationResult_<br/>or<br/>_undefined_ | **undefined** if the data is loading or an error has occurred, otherwise a map from the name of each **QueryDefinition** defined in the **Query** to the resulting data for that query |
| **engine** | [_Data Engine_](../advanced/DataEngine.md) | A reference to the DataEngine instance |

## Example

Expand Down
32 changes: 16 additions & 16 deletions docs/components/DataQuery.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DataQuery Component

A thin wrapper around the [useDataQuery](hooks/useDataQuery.md) hook
A thin wrapper around the [useDataQuery](../hooks/useDataQuery.md) hook

## Basic Usage

Expand All @@ -19,24 +19,24 @@ return (

## Input Props

| Name | Type | Required | Description |
| :------------: | :-----------------------: | :----------: | -------------------------------------------------------------------------------------------------------------------------- |
| **query** | [_Query_](types/Query.md) | **required** | The Query definition describing the requested data |
| **variables** | _Object_ | | Variables to be passed to the dynamic portions of the query |
| **onComplete** | _Function_ | | Callback function to be called on successfull completion of the query. Called with the response data as the only argument. |
| **onError** | _Function_ | | Callback function to be called on failure of the query. Called with the error instance as the only argument. |
| **lazy** | _boolean_ | | If true, wait until `refetch` is called before fetching data.<br/>_**Default**: `false`_ |
| Name | Type | Required | Description |
| :------------: | :--------------------------: | :----------: | -------------------------------------------------------------------------------------------------------------------------- |
| **query** | [_Query_](../types/Query.md) | **required** | The Query definition describing the requested data |
| **variables** | _Object_ | | Variables to be passed to the dynamic portions of the query |
| **onComplete** | _Function_ | | Callback function to be called on successfull completion of the query. Called with the response data as the only argument. |
| **onError** | _Function_ | | Callback function to be called on failure of the query. Called with the error instance as the only argument. |
| **lazy** | _boolean_ | | If true, wait until `refetch` is called before fetching data.<br/>_**Default**: `false`_ |

## Render Function Props

| Name | Type | Description |
| :---------: | :----------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **called** | _boolean_ | **true** if the data request has been initiated with either `lazy: false` or `refetch()` at least once |
| **loading** | _boolean_ | **true** if the data is not yet available and no error has yet been encountered |
| **error** | _Error_<br/>or<br/>_undefined_ | **undefined** if no error has occurred, otherwise the Error which was thrown |
| **data** | _QueryResult_<br/>or<br/>_undefined_ | **undefined** if the data is loading or an error has occurred, otherwise a map from the name of each **QueryDefinition** defined in the **Query** to the resulting data for that query |
| **refetch** | _Function_ | This function can be called to refetch the data. Any in-flight HTTP requests will automatically be aborted. |
| **engine** | [_Data Engine_](advanced/DataEngine) | A reference to the DataEngine instance |
| Name | Type | Description |
| :---------: | :----------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **called** | _boolean_ | **true** if the data request has been initiated with either `lazy: false` or `refetch()` at least once |
| **loading** | _boolean_ | **true** if the data is not yet available and no error has yet been encountered |
| **error** | _Error_<br/>or<br/>_undefined_ | **undefined** if no error has occurred, otherwise the Error which was thrown |
| **data** | _QueryResult_<br/>or<br/>_undefined_ | **undefined** if the data is loading or an error has occurred, otherwise a map from the name of each **QueryDefinition** defined in the **Query** to the resulting data for that query |
| **refetch** | _Function_ | This function can be called to refetch the data. Any in-flight HTTP requests will automatically be aborted. |
| **engine** | [_Data Engine_](../advanced/DataEngine.md) | A reference to the DataEngine instance |

## Example

Expand Down
6 changes: 3 additions & 3 deletions docs/components/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React Components

As an alternative to [React Hooks](hooks/), the DHIS2 Application Runtime support render-prop React components. The following Components are supported:
As an alternative to [React Hooks](../hooks/README.md), the DHIS2 Application Runtime support render-prop React components. The following Components are supported:

- [**DataQuery**](components/DataQuery) - a data fetching Component wrapper around the [useDataQuery](hooks/useDataQuery) hook.
- [**DataMutation**](components/DataMutation) - a Component wrapper around the [useDataMutation](hooks/useDataMutation) hook.
- [**DataQuery**](./DataQuery.md) - a data fetching Component wrapper around the [useDataQuery](../hooks/useDataQuery.md) hook.
- [**DataMutation**](./DataMutation.md) - a Component wrapper around the [useDataMutation](../hooks/useDataMutation.md) hook.
Loading
Loading