Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to use nextResultKey on mount #73

Merged
merged 3 commits into from
Aug 28, 2018

Conversation

dxinteractive
Copy link
Contributor

The RequestHock has an issue when a new RequestHock mounts and refetches using a resultKey that already has data returned for it (data that is held in the enty state store). On mount, the RequestHock was not bringing the resultKey into its own state, so it would not show existing response data, but it would use the refetching request state rather than the fetching request state. This meant that it was possible to have undefined results in a refetchingMap in cases where that data's existence should be guaranteed.

As all enty state around resultKeys is held outside of the RequestHock, then the RequestHock should essentially be a slave to that state.

Current behaviour

"A" and "B" are example resultKeys. The resultKey incidates which resultKey is being used to pull data from the enty state store.

Status resultKey nextResultKey Description
nothing - -
fetching - "A" make request
success "A" -
refetching "A" "B" make new request
success "B" -
refetching "B" "B" make same request
success "B" -

If we were to then remount the RequestHock and request the most recent resultKey again, the following would occur:

Status resultKey nextResultKey
refetching - (!!!) "B"
success "B" -

"!!!" marks where the resultKey is not set, but should have "B". It's known that "B" will be returned, as it has just been requested, so showing any possibly-existing response data during refetching makes sense.

@allanhortle allanhortle mentioned this pull request Aug 28, 2018
@allanhortle allanhortle merged commit f06069f into master Aug 28, 2018
@allanhortle allanhortle deleted the feature/refetch-with-no-response branch August 28, 2018 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants