Bug when re-showing a sketch in a viewer (dev)

Hi @alex
I’m coming back for our geometry viewer.
I have a bug happening only with sketches (received from TopSolid, no problems with other objects as forms). Using the filtering extension, when I hide, it is ok, but when I show back, i have kind of an infinite loop in the console. Which prevent me to code a button.
Here is a really small example (try activate the showObjects line), let me know if you need me to build it on github.
As it happens only with sketches, I have the feeling the error may come from the three.js handling of lines objects?
Thanks!

import {
  Viewer,
  SpeckleLoader,
  CameraController,
  UrlHelper,
  FilteringExtension,
} from "@speckle/viewer";

async function main() {
  const speckleContainer = document.createElement("div");
  speckleContainer.id = "speckle-container";
  document.body.appendChild(speckleContainer);

  const viewer = new Viewer(speckleContainer);
  await viewer.init();

  const cameraController = viewer.createExtension(CameraController);
  cameraController.toggleCameras();

  const filtering = viewer.createExtension(FilteringExtension);

  const urls = await UrlHelper.getResourceUrls(
    "https://app.speckle.systems/projects/d5b671524f/models/75e4788d3e@58fb90f03e"
  );
  for (const url of urls) {
    const loader = new SpeckleLoader(viewer.getWorldTree(), url, "");
    await viewer.loadObject(loader, true);
  }

  filtering.hideObjects(["7a531d10f5d8389f903582e373976dfc"]);
  //filtering.showObjects(["7a531d10f5d8389f903582e373976dfc"]);
}

main();
1 Like

Hi @RaphaelVouilloz

There indeed was a bug with the viewer library that we’ve been seeing happening for a while now, but we couldn’t reproduce. But with your help we finally managed to isolate, reproduce and finally fix it so a big thank you for your help! :partying_spockle:

It’s already up on the repository and we’ll make a viewer library release ASAP.
*Edit: A new version has been published

Cheers

3 Likes

Awesome, thanks @alex
Happy to helped :smiley_spockle: works perfectly now

2 Likes