Skip to content

Commit

Permalink
feat: no need to wrap retryTimes into Observable
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Aug 9, 2019
1 parent 96bbf1d commit edb8b1b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 31 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js

node_js: stable
node_js: --lts

cache: yarn

Expand All @@ -11,7 +11,6 @@ before_install:
- git config --global user.email '[email protected]'

script:
- set -e
- yarn lint
- yarn build
- yarn run build-storybook
Expand All @@ -21,7 +20,7 @@ deploy:
skip_cleanup: true
script: bash deploy.sh
on:
branch: release
branch: master
- provider: pages
email: [email protected]
name: JounQin
Expand Down
15 changes: 9 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

set -e

git remote set-url origin https://user:$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
git remote set-url origin "https://user:$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git"
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"

git fetch origin master:master
git checkout master
yarn run standard-version -a
git push --follow-tags origin master

cd dist
npm publish --access=public
PKG_VERSION=$(jq -r '.version' src/package.json)

git fetch origin v"$PKG_VERSION" || {
yarn run standard-version -a --release-as "$PKG_VERSION"
git push --follow-tags origin master
npm publish dist --access=public
}
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxts/ngrx",
"version": "0.3.1",
"version": "0.0.0",
"description": "🎉 Angular + RxJS + TypeScript = 🔥",
"repository": "[email protected]:rx-ts/ngrx.git",
"author": "JounQin <[email protected]>",
Expand Down Expand Up @@ -85,10 +85,5 @@
"extends": [
"1stg"
]
},
"standard-version": {
"skip": {
"bump": true
}
}
}
20 changes: 5 additions & 15 deletions src/directives/async.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import {
ViewRef,
} from '@angular/core'
import { Observable, Subject, Subscription, combineLatest } from 'rxjs'
import {
finalize,
retry,
startWith,
takeUntil,
withLatestFrom,
} from 'rxjs/operators'
import { finalize, retry, startWith, takeUntil } from 'rxjs/operators'

import { Callback, Nullable } from '../types/public-api'
import { ObservableInput } from '../utils/public-api'
Expand Down Expand Up @@ -47,9 +41,8 @@ export class AsyncDirective<T, P, E = HttpErrorResponse>
@Input('rxAsyncRefetch')
private refetch$$ = new Subject<void>()

@ObservableInput()
@Input('rxAsyncRetryTimes')
private retryTimes$!: Observable<number>
private retryTimes?: number

private destroy$$ = new Subject<void>()
private reload$$ = new Subject<void>()
Expand Down Expand Up @@ -78,11 +71,8 @@ export class AsyncDirective<T, P, E = HttpErrorResponse>
this.refetch$$.pipe(startWith(null)),
this.reload$$.pipe(startWith(null)),
])
.pipe(
takeUntil(this.destroy$$),
withLatestFrom(this.retryTimes$),
)
.subscribe(([[context, fetcher, params], retryTimes]) => {
.pipe(takeUntil(this.destroy$$))
.subscribe(([context, fetcher, params]) => {
this.disposeSub()

Object.assign(this.context, {
Expand All @@ -93,7 +83,7 @@ export class AsyncDirective<T, P, E = HttpErrorResponse>
this.sub = fetcher
.call(context, params)
.pipe(
retry(retryTimes),
retry(this.retryTimes),
finalize(() => {
this.context.loading = false
if (this.viewRef) {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxts/ngrx",
"version": "0.3.1",
"version": "0.3.2",
"description": "🎉 Angular + RxJS + TypeScript = 🔥",
"repository": "[email protected]:rx-ts/ngrx.git",
"author": "JounQin <[email protected]>",
Expand Down

0 comments on commit edb8b1b

Please sign in to comment.