Skip to content

Commit

Permalink
fix errros
Browse files Browse the repository at this point in the history
  • Loading branch information
gearmobile committed Jul 22, 2024
1 parent 435545f commit b693c21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions _posts/2024-07-03-withLatestFrom.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ share: true

Пример схематичный:

```ts
{% highlight typescript %}
hello$.pipe(
withLatestFrom(this.toggleService.isEnabled('some-feature'))
)
```
{% endhighlight %}

... то есть - в данном случае, если значение пришло из родительского потока _hello$_ - оператор _withLatestFrom_ заберет значение из метода сервиса _isEnabled_ и вернет - поток из этих двух значений.

Пример реальный, из эффекта NgRx:

```ts
{% highlight typescript %}
export const saveCounter = createEffect(
() =>
inject(Actions).pipe(
Expand All @@ -38,7 +38,7 @@ export const saveCounter = createEffect(
),
{ dispatch: false, functional: true }
);
```
{% endhighlight %}

... здесь запись _ofType(CounterActions.incrementCounter, CounterActions.decrementCounter)_, трактуется как ИЛИ; то есть, оператор _ofType_ будет фильтровать поток _actions$_ на экшен _incrementCounter_ или экшен _decrementCounter_.

Expand Down
4 changes: 2 additions & 2 deletions _posts/2024-07-12-fallering-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ share: true

### Разбор примера

```ts
{% highlight typescript %}
export const productsLoadEffect = createEffect(
(actions$ = inject(Actions), productsService = inject(ProductsService)) =>
actions$.pipe(
Expand Down Expand Up @@ -110,7 +110,7 @@ export const productsRemoveEffect = createEffect(
),
{ functional: true },
);
```
{% endhighlight %}

1. так как нет никаких параметров (фильтры, сортировка, пагинация), то нет смысла делать несколько запросов для загрузки одних и тех же данных
2. Добавление новых продуктов не требует жесткого порядка, нам без разницы какой запрос на добавление нового продукта выполнится раньше, первый или второй, главное чтобы они добавились, поэтому mergeMap
Expand Down

0 comments on commit b693c21

Please sign in to comment.