imodeljs / frontend-sample-showcase

MIT License
17 stars 9 forks source link

Tree sample support #249

Closed StefanRetief closed 3 years ago

StefanRetief commented 3 years ago

Added support for a viewer without an iModel viewport. Instead, given a component that accepts an imodel connection, you can now make samples that can rely on the imodel connection provided by the viewer and use it for the main content in the display.

Currently, all UI Tree samples use this method.

Also included in this PR are the @itwinjs-sandbox files being exposed in the editor. Right clicking "Go To Definition" will reveal the contents of the file in @itwinjs-sandbox instead of just the minified typedef.

roluk commented 3 years ago

When attempting to edit tree samples, I'm getting error IModelApp.startup must be called before calling Presentation.initialize.

StefanRetief commented 3 years ago

When attempting to edit tree samples, I'm getting error IModelApp.startup must be called before calling Presentation.initialize.

I added some retry logic to make sure the sample will try again when it fails to load correctly.

An unfortunate part of how the samples work is that since the initialization relies on async calls and there isn't a good way to check the status of the call, or where the sample is in the rendering process, these errors are bound to happen. More or less, we want to minimize the impact on users, so if an error pops up in the console but the viewport is still in a useable state (barring having to close the react error handling page), that is all we can do.