Skip to content

Commit

Permalink
Fix delta url with deltaBundleId
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Feb 9, 2019
1 parent 6ad8088 commit b7f0c2d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/middlewares/delta/deltaUrlToBlobUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ export default async function deltaUrlToBlobUrl(deltaUrl) {
const lastBundleId = client.getLastBundleId();

const deltaBundleId = lastBundleId
? `${lastBundleId.indexOf('?') === -1 ? '?' : '&'}deltaBundleId=${lastBundleId}`
? `${deltaUrl.indexOf('?') === -1 ? '?' : '&'}deltaBundleId=${lastBundleId}`
: '';


const data = await fetch(deltaUrl + deltaBundleId);
const bundle = await data.json();

const isOld = bundle.id;

const deltaPatcher = client.applyDelta(isOld ? {
id: bundle.id,
pre: new Map(bundle.pre),
post: new Map(bundle.post),
delta: new Map(bundle.delta),
reset: bundle.reset,
} : bundle);
const deltaPatcher = client.applyDelta(
isOld
? {
id: bundle.id,
pre: new Map(bundle.pre),
post: new Map(bundle.post),
delta: new Map(bundle.delta),
reset: bundle.reset,
}
: bundle
);

const cachedBundle = cachedBundleUrls.get(deltaUrl);

Expand Down

0 comments on commit b7f0c2d

Please sign in to comment.