Skip to content

Commit c51c371

Browse files
committed
fix(demo-snippets): broken demos
1 parent 6b9a2d6 commit c51c371

File tree

8 files changed

+23
-14
lines changed

8 files changed

+23
-14
lines changed

demo-snippets/guides/loading_scenes/public_scene.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { View } from "@novorender/api";
44
export async function main(view: View): Promise<void> {
55
// Initialize the data API with the Novorender data server service
66
const dataApi = createAPI({
7-
serviceUrl: "https://data.novorender.com/api",
7+
serviceUrl: "https://data-v2.novorender.com/api",
88
});
99

1010
// Load scene metadata

demo-snippets/guides/object_groups/floors.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,29 @@ async function handleVisibilityChanges(dataApi: API, groups: ObjectGroup[]): Pro
4444
// when needed as to not bloat the .loadScene() response
4545
const groupIdRequests: Promise<void>[] = groups.map(async (group) => {
4646
if ((group.selected || group.hidden) && !group.ids) {
47-
group.ids = await dataApi.getGroupIds(SCENE_ID, group.id).catch(() => {
48-
console.warn("failed to load ids for group - ", group.id);
49-
return [];
50-
});
47+
group.ids = await fetch(`https://data-v2.novorender.com/explorer/${SCENE_ID}/groups/${group.id}/ids`)
48+
.then(response => {
49+
if (!response.ok) {
50+
console.warn("Failed to load ids for group - ", group.id);
51+
return [];
52+
}
53+
return response.json();
54+
})
55+
.catch(() => {
56+
console.warn("Failed to load ids for group - ", group.id);
57+
return [];
58+
});
59+
5160
}
5261
});
5362

54-
// Increment current refillId and assign local copy
63+
// // Increment current refillId and assign local copy
5564
const id = ++refillId;
5665

57-
// Wait for IDs to be loaded if necessary
66+
// // Wait for IDs to be loaded if necessary
5867
await Promise.all(groupIdRequests);
5968

60-
// Abort changes if they are stale
69+
// // Abort changes if they are stale
6170
if (id !== refillId) {
6271
return {};
6372
}

demo-snippets/guides/object_selection/color.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createColorSetHighlight, type RenderStateChanges } from "@novorender/ap
22

33
export function main(): RenderStateChanges {
44
const highlight = createColorSetHighlight([0, 1, 0]);
5-
const objectIds = [2, 2221]; // list of objects that we want to highlight
5+
const objectIds = [2, 2221, 3189]; // list of objects that we want to highlight
66
return {
77
highlights: {
88
groups: [{ action: highlight, objectIds }],

demo-snippets/guides/object_selection/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createColorSetHighlight, createTransparentHighlight, type RenderStateCh
33
export function main(): RenderStateChanges {
44
const limeGreen = createColorSetHighlight([0, 1, 0]);
55
const semiTransparent = createTransparentHighlight(0.5);
6-
const objectIds = [2, 2221]; // list of objects that we want to highlight
6+
const objectIds = [2, 2221, 3189]; // list of objects that we want to highlight
77
return {
88
highlights: {
99
defaultAction: semiTransparent, // applies to all objects not in a group.

demo-snippets/hosts/clipping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ClippingDemoHost extends BaseDemoHost implements IDemoHost<Module>
1414
async init() {
1515
// Initialize the data API with the Novorender data server service
1616
const dataApi = createAPI({
17-
serviceUrl: "https://data.novorender.com/api",
17+
serviceUrl: "https://data-v2.novorender.com/api",
1818
});
1919

2020
// Load scene metadata

demo-snippets/hosts/objectGroups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ObjectGroupsDemoHost extends BaseDemoHost implements IDemoHost<Modu
1414
async init() {
1515
// Initialize the data API with the Novorender data server service
1616
this.dataAPI = createAPI({
17-
serviceUrl: "https://data.novorender.com/api",
17+
serviceUrl: "https://data-v2.novorender.com/api",
1818
});
1919
let moduleError;
2020

demo-snippets/hosts/stateCondos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class StateCondosDemoHost extends StateDemoHost {
55
async init(): Promise<void> {
66
// Initialize the data API with the Novorender data server service
77
const dataApi = createAPI({
8-
serviceUrl: "https://data.novorender.com/api",
8+
serviceUrl: "https://data-v2.novorender.com/api",
99
});
1010

1111
// Load scene metadata

demo-snippets/hosts/viewCondos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class ViewCondosDemoHost extends ViewDemoHost {
55
async init(): Promise<void> {
66
// Initialize the data API with the Novorender data server service
77
const dataApi = createAPI({
8-
serviceUrl: "https://data.novorender.com/api",
8+
serviceUrl: "https://data-v2.novorender.com/api",
99
});
1010

1111
// Load scene metadata

0 commit comments

Comments
 (0)