Skip to content

Commit

Permalink
fix broken registry, fixing story-line demo
Browse files Browse the repository at this point in the history
  • Loading branch information
traut committed Dec 8, 2021
1 parent 0527e3c commit 7941d16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/stixview.bundle.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const initCallbacks = {};
const loadCallbacks = {};

function init(element, initCallback, loadCallback, extraDataProps, extraViewProps) {
if (element in registry) {
return registry[element];
if (element.stixViewId && element.stixViewId in registry) {
return registry[element.stixViewId];
}
const gistId = element.dataset.stixGistId;
const gistFile = element.dataset.gistFile;
Expand Down Expand Up @@ -137,7 +137,9 @@ function init(element, initCallback, loadCallback, extraDataProps, extraViewProp
}

element.dataset.stixViewId = Math.random().toString(16).slice(2);
registry[element] = graph;
registry[element.dataset.stixViewId] = graph;

element.stixViewId = element.dataset.stixViewId;

return graph;
}
Expand Down

0 comments on commit 7941d16

Please sign in to comment.