Problem with your code - Convert Blob to http?

Hi,

With my tree viz, I have a problem with a single dataset, that triggers an error in your code. Only the taskIndex.json is a problem, all other json files work correctly. I have tested this data file in Observable tree view and it works perfectly. I cannot see any issue in the data layout or values.

OS-Threat UI (vizhub.com)

However, when one selects the ‘Task’ value from the radio buttons, then the folloing error appears, why?

hey @curran,

I keep having problem with this error, with this specific dataset. I cannot seem to fix it, no matter how i change my algorithm.

IS this your code??? Why does this problem keep happening, yet the dataset will work fine on a treeview on Observables?

Check this out here Collapsible Indented Tree Variation v3, d3v4. / brettforbes | Observable (observablehq.com)

Yet it will not work in vizhub, why?

Pressing the other radio buttons reveals no problem with any of the other treedata records, yet this one will not work. Why???

Hey @brettforbes! I think the issue is that your code is trying to fetch files that are not served by VizHub. If I open the console on the viz link you shared, this is what I see:

It looks to me like these files listed here do not actually exist in your viz:

const working_map = {
  unattached: 'unattached.json',
  attached: 'attached.json',
  promoted: 'promoted.json',
};

Try adding those files in your list of files, then I think it should work. Good luck!

P. S. the VizHub Discord is better for quick responses. Sorry I took so long to see this post!

Hi @curran,

Thanks for the reply. I have edited out that entire section, so those files aren’t missing anymore.

But the problem with your Fetch code persists. Try pressing the radio button. You will see all options work flawlessly, except for the Task option. Yet I can load this Task data in Observables as shown above.

Why will the Task data not work on vizhub?

It looks like your code is passing undefined as the URL to fetch, so the code that expects the URL to be a string is failing.

The “fetch simulator” is indeed a part of the VizHub codebase. One thing I can do is make it more robust, so if you pass undefined as the URL it can give a better error.

Try to console.log the URL you are fetching, and see when it comes up as undefined. Good luck!

brilliant thank you, i had no idea, let me check that thanks @curran

hi @curran,

Thanks for your brilliant insights. It actually turned out that i wasn’t able to load the data file, since i had my radio button return the plural “tasks” instead of the singular “task”. So when the button value was used as a key to decode the path of the file, no path was returned.

In short, the error occurred long before the image, in the file loading code. Perhaps an error message in the translation of the filename if it is not valid, might be pretty useful for dummies like myself?

1 Like