Skip to content

Commit 7f1fe7d

Browse files
authored
Merge pull request #12 from vtex/feature/retry
Add retry for ajax requests
2 parents 155541c + db87153 commit 7f1fe7d

File tree

5 files changed

+66
-2
lines changed

5 files changed

+66
-2
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--- Provide a general summary of the issue in the Title above -->
2+
3+
## Expected Behavior
4+
<!--- If you're describing a bug, tell us what should happen -->
5+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
6+
7+
## Current Behavior
8+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
9+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
10+
11+
## Possible Solution
12+
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
13+
<!--- or ideas how to implement the addition or change -->
14+
15+
## Steps to Reproduce (for bugs)
16+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
17+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
18+
1.
19+
2.
20+
3.
21+
4.
22+
23+
## Context
24+
<!--- How has this issue affected you? What are you trying to accomplish? -->
25+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
26+
27+
## Your Environment
28+
<!--- Include as many relevant details about the environment you experienced the bug in -->
29+
* Version used:
30+
* Environment name and version (e.g. Chrome 39, node.js 5.4):
31+
* Operating System and version (desktop or mobile):
32+
* Link to your project:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#### What is the purpose of this pull request?
2+
<!--- Describe your changes in detail. -->
3+
4+
#### What problem is this solving?
5+
<!--- What is the motivation and context for this change? -->
6+
7+
#### How should this be manually tested?
8+
9+
#### Screenshots or example usage
10+
11+
#### Types of changes
12+
- [ ] Bug fix (non-breaking change which fixes an issue)
13+
- [ ] New feature (non-breaking change which adds functionality)
14+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
15+
- [ ] Requires change to documentation, which has been updated accordingly.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.1.8] - 2019-04-22
11+
12+
### Added
13+
14+
- Retry for ajax requests

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vtex/render-extension-loader",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "VTEX IO Render Extension Loader",
55
"main": "lib/render-extension-loader.js",
66
"browser": "lib/render-extension-loader.js",

src/render-extension-loader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ class RenderExtensionLoader {
3131
this.timeout = timeout
3232
this.publicEndpoint = publicEndpoint || (/myvtexdev\.com/.test(window.location.hostname) ? 'myvtexdev.com' : 'myvtex.com')
3333
this.get = window.$
34-
? ((url) => window.$.ajax({url, timeout: this.timeout}))
34+
? ((url) => window.$.ajax({ url, timeout: this.timeout }).retry({
35+
timeout: 2000,
36+
times: 2,
37+
}))
3538
: window.fetch
3639
? ((url) => new Promise((resolve, reject) => {
3740
const fetchTimeout = setTimeout(() => {

0 commit comments

Comments
 (0)