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

Fix duplicate ajax requests #36

Merged
merged 10 commits into from
Mar 17, 2017
Merged

Fix duplicate ajax requests #36

merged 10 commits into from
Mar 17, 2017

Conversation

ausi
Copy link
Owner

@ausi ausi commented Feb 25, 2017

Follow up to #35, #27

cachedCallback(response);
});
});
requestCache[href] = response;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a smart way to combine the two cache objects into one.

callback(requestCache[href]);
return;
}
else if (cacheEntryType === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking: will requestCache[href] ever be null (eg: failed xhr)? If so, might be worth a truthiness check.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requestCache[href] will be undefined initially, an array until the request is finished and a string afterwards. Failed XHRs are saved as an empty string, so it should never be null.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, that's what I figured but just wanted to make sure.

@ausi ausi force-pushed the pl12133-issue/27 branch from 24ef974 to c53e5d9 Compare March 17, 2017 15:28
@ausi ausi force-pushed the pl12133-issue/27 branch from c53e5d9 to d11561a Compare March 17, 2017 15:55
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 99.34% when pulling d11561a on pl12133-issue/27 into ec50065 on master.

@ausi ausi merged commit 87416b2 into master Mar 17, 2017
@ausi ausi deleted the pl12133-issue/27 branch May 22, 2017 19:10
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.

4 participants