From 68e16f338e027b7ca786869a004b23291535b9c8 Mon Sep 17 00:00:00 2001 From: Ben Kalman Date: Thu, 7 Jul 2016 18:19:18 -0700 Subject: [PATCH] Fix noms browser fetch and splore layout (#1989) --- js/src/browser/fetch.js | 10 ++++++++-- samples/js/splore/src/main.js | 2 +- samples/js/splore/src/node.js | 8 ++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/src/browser/fetch.js b/js/src/browser/fetch.js index 8d68f0f1e8..667a368922 100644 --- a/js/src/browser/fetch.js +++ b/js/src/browser/fetch.js @@ -48,7 +48,10 @@ export function fetchText(url: string, options: FetchOptions = {}): Promise ({headers: resp.headers, buf: resp.text()})); + .then(resp => { + const {headers} = resp; + return resp.text().then(text => ({headers, buf: text})); + }); } return fetch(url, 'text', options); @@ -58,7 +61,10 @@ export function fetchUint8Array(url: string, options: FetchOptions = {}): Promis if (self.fetch) { return self.fetch(url, options) // resp.headers is a Headers which is a multi map, which is similar enough for now. - .then(resp => ({headers: resp.headers, buf: new Uint8Array(resp.arrayBuffer())})); + .then(resp => { + const {headers} = resp; + return resp.arrayBuffer().then(buf => ({headers, buf: new Uint8Array(buf)})); + }); } return fetch(url, 'arraybuffer', options); diff --git a/samples/js/splore/src/main.js b/samples/js/splore/src/main.js index b86459c6b4..0f2153ad8e 100644 --- a/samples/js/splore/src/main.js +++ b/samples/js/splore/src/main.js @@ -97,7 +97,7 @@ function handleChunkLoad(hash: Hash, val: any, fromHash: ?string) { name: string) { data.nodes[id] = {name: name}; sequence.items.forEach(tuple => { - const kid = process(hash, formatKeyString(tuple.child), id); + const kid = process(hash, formatKeyString(tuple.ref), id); if (kid) { data.nodes[kid].isOpen = true; diff --git a/samples/js/splore/src/node.js b/samples/js/splore/src/node.js index 6a3fce7b92..352341ab1c 100644 --- a/samples/js/splore/src/node.js +++ b/samples/js/splore/src/node.js @@ -69,12 +69,8 @@ export default class Node extends React.Component { {this.getShape()} -

- {text} -

+ width={this.props.spaceX - 20} height='0.7em'> +

{text}

);