Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Aug 23, 2023
1 parent 97b5d73 commit 57566ed
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 15 additions & 1 deletion apps/website/docs/releases/0-9.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ Since v0.9 is technical release with no new significant features, there are a fe

### Separate [_Event_](https://effector.dev/docs/api/effector/event) for [_Query_](/api/primitives/query) cancelation

Cancelled [_Queries_](/api/primitives/query) were treated as failed before this release. We have added a separate [_Event_](https://effector.dev/docs/api/effector/event) `.aborted` to [_Query_](/api/primitives/query) to distinguish between cancelation and failure. It is recommended to use `.aborted` instead of `.finished.failure` to handle cancelation. In the next release v0.10 cancelation will not be treated as failure anymore, so you will have to handle it explicitly.
Cancelled [_Queries_](/api/primitives/query) were treated as failed before this release. We have added a separate [_Event_](https://effector.dev/docs/api/effector/event) `.aborted` to [_Query_](/api/primitives/query) to distinguish between cancelation and failure. It is recommended to use `.aborted` instead of `.finished.failure` to handle cancelation.

:::warning
In the next release v0.10 cancelation will not be treated as failure anymore, so you will have to handle it explicitly.
:::

### `supressIntermediateErrors` in `retry` operator

Before this release, [`retry`](/api/operators/retry) operator was marking [_Query_](/api/primitives/query) as failed on every failed attempt. Since v0.9 it accepts options `supressIntermediateErrors` to overwrite this behavior. If `true`, then the [_Query_](/api/primitives/query) will not be marked as failed until the last attempt is failed.

:::warning

In the next release v0.10 `supressIntermediateErrors` will be true `true` by default. To restore the previous behavior, you will have to set it to `false` explicitly.

:::

<!--@include: ./0-9.changelog.md-->
16 changes: 16 additions & 0 deletions apps/website/docs/tutorial/retries.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ retry(characterQuery, {

`mapParams` accepts a function that takes current parameters, occurred error and attempt number and returns new parameters. In this example, we just add `attempt` parameter to the current parameters.

## Intermediate errors

By default, `retry` does not supress errors, so if the operation failed, it will fail as well. But sometimes, we want to suppress errors and check for status only after all retries are failed. To do this, we can use the `supressIntermediateErrors` option of the `retry` operator.

```ts
retry(characterQuery, {
times: 5,
delay: 500,
supressIntermediateErrors: true,
});
```

::: tip
In the next release v0.10 `supressIntermediateErrors` will be true `true` by default. To restore the previous behavior, you will have to set it to `false` explicitly. If you want to be ready for this change, you can set it to `false` already.
:::

## API reference

You can find the full API reference for the `retry` operator in the [API reference](/api/operators/retry).
2 changes: 1 addition & 1 deletion packages/core/src/retry/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type RetryConfig<
MapParamsSource
>;
otherwise?: Event<FailInfo<Q>>;
supressIntermediateErrors?: true;
supressIntermediateErrors?: boolean;
};

export function retry<
Expand Down

0 comments on commit 57566ed

Please sign in to comment.