-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Conversation
cachedCallback(response); | ||
}); | ||
}); | ||
requestCache[href] = response; |
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.
That's a smart way to combine the two cache objects into one.
callback(requestCache[href]); | ||
return; | ||
} | ||
else if (cacheEntryType === 'object') { |
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.
Just double checking: will requestCache[href]
ever be null
(eg: failed xhr)? If so, might be worth a truthiness check.
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.
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
.
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.
Perfect, that's what I figured but just wanted to make sure.
Follow up to #35, #27