Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(main): control fetch() based on subscription count
instead of using @asStream() to determine the state of the component and thus figure out if the HTTP request needs to be made or not, we decide it based on if there is a subscription or not BREAKING CHANGES: @asStream() is not needed. removed reload(). removed isLoading().
- Loading branch information
1 parent
15732e5
commit a00ffbe
Showing
12 changed files
with
59 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
const Rx = require('rx') | ||
const targs = require('argtoob') | ||
module.exports = store => { | ||
const request = store | ||
.filter(x => x.event === 'REQUEST').pluck('args') | ||
'use strict' | ||
|
||
const response = store | ||
.filter(x => x.event === 'RESPONSE').map(x => x.args[0]) | ||
|
||
const json = response.flatMap(x => x.json()) | ||
|
||
return Rx.Observable.zip( | ||
request, | ||
response, | ||
json, | ||
targs('request', 'response', 'json') | ||
).share() | ||
} | ||
module.exports = store => store.flatmap( | ||
response => response.json().then(json => ({json, response})) | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters