Skip to content

Commit

Permalink
Fixed typo, made debug docs more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey20x25 authored Sep 27, 2022
1 parent 3c046f2 commit fea1d8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/debug/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ e.g., an unit may be exported under an alias for explicitness:

```ts
export const $productsListVisible = productsPageModel.$open;
const productAdded = createEvent();

debug($productsListVisible, productAdded);
// or
Expand All @@ -79,17 +80,18 @@ debug({ trace: true }, $productsListVisible, productAdded);

In this case, because of `effector/babel-plugin` which provided `productsPageModel.$open` store its name at the moment of its creation, public name in the `debug` logs will be `$open` instead of `$productsListVisible`.

It can be fixed with custom name, which can be provided by using `Record<string, Unit>` istead of a list of units:
It can be fixed with custom name, which can be provided by using `Record<string, Unit>` instead of a list of units:

```ts
export const $productsListVisible = productsPageModel.$open;
const productAdded = createEvent();

debug({ $productsListVisible, customEventName: productAdded });
// or
debug({ trace: true }, { $productsListVisible, customEventName: productAdded });
```

This way `$productsListVisible` name in the logs will be the same, as the one which was provided to `debug`.
This way `$productsListVisible` name in the logs will be the same, as the one which was provided to `debug`. The `productAdded` event will be named `customEventName`.

## Fork API and Scope

Expand Down

0 comments on commit fea1d8d

Please sign in to comment.