Skip to content

Commit

Permalink
Ignore query strings in Altair component
Browse files Browse the repository at this point in the history
  • Loading branch information
WillHannon-MCB committed Feb 13, 2024
1 parent 9389169 commit dac1c84
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .vitepress/theme/Altair.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ export default {
methods: {
async loadChart(url) {
try {
// Get the path to check the file format
const urlObj = new URL(url);
const path = urlObj.pathname;
// Get the response from the URL
const response = await fetch(url);
let spec;
// Check if URL ends with '.html'
if (url.endsWith('.html')) {
if (path.endsWith('.html')) {
const htmlContent = await response.text();
spec = await parseVegaSpecFromHTML(htmlContent);
}
// Check if URL ends with '.json'
else if (url.endsWith('.json')) {
else if (path.endsWith('.json')) {
spec = await response.json();
}
else {
Expand Down

0 comments on commit dac1c84

Please sign in to comment.