-
Notifications
You must be signed in to change notification settings - Fork 109
Add a clean way to consolidate data in Poll
#43
Conversation
Generated by 🚫 dangerJS |
this.keepPolling = false; | ||
this.setState(() => ({ polling: false, finished: true })); // let everyone know we're done here. | ||
}; | ||
|
||
public componentDidMount() { | ||
const { path, lazy } = this.props; | ||
|
||
if (!path) { | ||
if (path === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But path
is required in the interface 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Why can we not poll on the base
? It's works for Get
so…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep the path
mandatory to avoid mistake, so we need to path=""
if we want this case (a bit stupid but explicit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I may have your comment, it's for javascript users ^^ (this case is not possible in typescript of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Why
Our server send us chunk instead of a complete response on long polling (for obvious performance reasons ^^)
The idea is to have
prevData
available in thePoll:resolve
props, so we can do:I also add a lot of unit tests to
Poll
and fix some little behaviour on my way: