iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
619 stars 210 forks source link

iModel viewer shows nothing but point clouds (4.6 to 4.7) #6964

Open lijiayi0921 opened 4 months ago

lijiayi0921 commented 4 months ago

Hi,

My iModel view does not load the 3D model. It loads the point clouds correctly.

No error from console. Scopes are : imodelaccess:read imodels:read itwinjs (I tried itwin-platform but the same)

This happens since I moved from 4.6 to 4.7 (although many other issues are solved thanks to the help from this forum) I'm using the packages from the latest "npx create-react-app .... --template @itwin/web-viewer " : (Which might not be the latest for every package)

"@itwin/appui-abstract": "^4.7.5",
    "@itwin/appui-layout-react": "^4.8.3",
    "@itwin/appui-react": "^4.15.2",
    "@itwin/browser-authorization": "^1.1.2",
    "@itwin/components-react": "^4.15.2",
    "@itwin/core-bentley": "^4.7.5",
    "@itwin/core-common": "^4.7.5",
    "@itwin/core-frontend": "^4.7.5",
    "@itwin/core-geometry": "^4.7.5",
    "@itwin/core-i18n": "^4.7.5",
    "@itwin/core-markup": "^4.7.5",
    "@itwin/core-orbitgt": "^4.7.5",
    "@itwin/core-quantity": "^4.7.5",
    "@itwin/core-react": "^4.15.2",
    "@itwin/core-telemetry": "^4.7.5",
    "@itwin/ecschema-metadata": "^4.7.5",
    "@itwin/imodel-browser-react": "^1.3.1",
    "@itwin/imodel-components-react": "^4.15.2",
    "@itwin/imodels-access-frontend": "^4.1.6",
    "@itwin/itwinui-react": "^2.12.26",
    "@itwin/measure-tools-react": "^0.13.0",
    "@itwin/presentation-common": "^4.7.5",
    "@itwin/presentation-components": "^4.4.1",
    "@itwin/presentation-frontend": "^4.7.5",
    "@itwin/property-grid-react": "^1.10.0",
    "@itwin/tree-widget-react": "^1.2.2",
    "@itwin/web-viewer-react": "^4.2.5",
    "@itwin/webgl-compatibility": "^4.7.5",

In the Tree View everything is shown. Any idea why this happens ?

Thank you Jiayi

hl662 commented 4 months ago

If you open the network tab in the dev tools, are there any requests that fail in 4.7 that wasn't in 4.6?

lijiayi0921 commented 4 months ago

Nothing fails in Network tab. Btw in order to have a working version of iTwin, I took the same implementation from the simple example from : "npx create-react-app .... --template @itwin/web-viewer " The simple viewer loads the model correctly. But my implementation does not - even if I change every property of Viewer to be the same.

   <Viewer
                iTwinId={props.file?.platformBucket}
                iModelId={props.file?.platformModel}
                authClient={authClient}
                viewCreatorOptions={viewCreatorOptions}
                enablePerformanceMonitors={process.env.MODE === 'DEBUG'}
                onIModelAppInit={onIModelAppInit}
                // onIModelConnected={onIModelConnected}
                // additionalI18nNamespaces={['safe', 'safeTools']}
                uiProviders={[
                    new ViewerNavigationToolsProvider(),
                    new ViewerContentToolsProvider({
                        vertical: {
                            measureGroup: false,
                        },
                    }),
                    new ViewerStatusbarItemsProvider(),
                    new TreeWidgetUiItemsProvider(),
                    new PropertyGridUiItemsProvider({
                        propertyGridProps: {
                            autoExpandChildCategories: true,
                            ancestorsNavigationControls: (props) => (
                                <AncestorsNavigationControls {...props} />
                            ),
                            contextMenuItems: [
                                (props) => <CopyPropertyTextContextMenuItem {...props} />,
                            ],
                            settingsMenuItems: [
                                (props) => (
                                    <ShowHideNullValuesSettingsMenuItem
                                        {...props}
                                        persist={true}
                                    />
                                ),
                            ],
                        },
                    }),
                    new MeasureToolsUiItemsProvider(),
                    ...(safeExt?.uiProviders ?? [])
                ]}
            />
hl662 commented 4 months ago

Is the simple example from npx create-react-app also using 4.7 packages? And that is loading the model correctly?

lijiayi0921 commented 4 months ago

Hi @hl662, thank you so much for following my issue. Yes the sample works correctly (package list as in my original post)

Comparing the network traffic, both seem to load the 3d model :

Sample viewer : image

My app image

I was comparing the resulting css in the navigator, didn't find anything significant yet. Could that be the issue ?

hl662 commented 4 months ago

I can't see CSS being the cause... if the tree on the side is shown, and you're able to see some stuff rendered on the page, and within the viewport... I'm surprised that there aren't any errors in the console?

lijiayi0921 commented 4 months ago

The only error is this (yet not everytime) : Root font size must not be overridden. See https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v2-migration-guide#relative-font-size There are warnings related to deprecated UI component as well.

It happens on localhost or deployed, with Chrome and with FF... Is there some viewer settings that could be the cause ?

hl662 commented 4 months ago

It's not too clear what the root cause is yet... I see from your package.json that you jumped straight to 4.7.5. Could you downgrade that to 4.7.0? Let's see if we could nail down which version of 4.7 is causing this problem, and compare that against the release change logs.

lijiayi0921 commented 4 months ago

Going back to 4.6.2 (for all packages that are at 4.7.5), problem solved, the model reappears. I'll try to go up again to see where it brreaks

lijiayi0921 commented 4 months ago

At 4.7.0 the model is not showing

hl662 commented 4 months ago

In the network tab, can you filter for these following requests that start with api.bentley.com/imodel/rpc/v4? If any are failing, please provide the x-correlation-id header value of those errors, so we can check on our side

lijiayi0921 commented 4 months ago

There were no request that were failing...

hl662 commented 4 months ago

if you were to compare the network requests and the waterfall between the sample viewer and your implementation of the viewer, are there discrepancies in the flow? Maybe some requests in one app weren't executed?

lijiayi0921 commented 4 months ago

Yes in my app there are some more requests (redundant ?).

Here they are filtered with "api.bentley.com/imodel/rpc/v4"

My app :

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

  |   |   |   |   |   |   |   -- | -- | -- | -- | -- | -- | -- | -- IModelReadRpcInterface-3.6.0-getConnectionProps?pa…mMmJmYWZmNjQ0N2ZmNTE3YzlmMzMwOGUyZjdlIn19XQ%3D%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 1.0 kB | 137 ms IModelReadRpcInterface-3.6.0-getConnectionProps?pa…mMmJmYWZmNjQ0N2ZmNTE3YzlmMzMwOGUyZjdlIn19XQ%3D%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 0 B | 113 ms PresentationRpcInterface-4.1.0-getSelectionScopes | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 498 B | 45 ms PresentationRpcInterface-4.1.0-getSelectionScopes | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 239 B | 81 ms IModelReadRpcInterface-3.6.0-getCustomViewState3dD…0N2ZmNTE3YzlmMzMwOGUyZjdlIiwiaW5kZXgiOjEwfX0se31d | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelReadRpcInterface-3.6.0-hydrateViewState?para…GVjdG9yU3RhdGVNb2RlbHMiOiIrMjAwMDAwMDAwMEMifV0%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelReadRpcInterface-3.6.0-querySubCategories?pa…rMUUrNDIrMyoyKzExKzEyKzE5KzUxNyszNDgrM0YrQytFNiJd | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelTileRpcInterface-3.2.0-requestTileTreeProps?…XgiOjEwfX0sIjIyXzFkLUU6MF8weDIwMDAwMDAwMDBjIl0%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 4 ms IModelReadRpcInterface-3.6.0-queryModelProps | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 490 B | 42 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 535 B | 325 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 502 B | 322 ms IModelTileRpcInterface-3.2.0-getTileCacheConfig | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 333 B | 42 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 533 B | 137 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 567 B | 81 ms IModelReadRpcInterface-3.6.0-queryRows | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 421 B | 30 ms IModelReadRpcInterface-3.6.0-queryRows | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 408 B | 37 ms

Sample viewer :

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

  |   |   |   |   |   |   |   -- | -- | -- | -- | -- | -- | -- | -- IModelReadRpcInterface-3.6.0-getConnectionProps?pa…mMmJmYWZmNjQ0N2ZmNTE3YzlmMzMwOGUyZjdlIn19XQ%3D%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 1.1 kB | 68 ms PresentationRpcInterface-4.1.0-getSelectionScopes | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 452 B | 31 ms IModelReadRpcInterface-3.6.0-getCustomViewState3dD…0N2ZmNTE3YzlmMzMwOGUyZjdlIiwiaW5kZXgiOjEwfX0se31d | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 2 ms IModelReadRpcInterface-3.6.0-hydrateViewState?para…GVjdG9yU3RhdGVNb2RlbHMiOiIrMjAwMDAwMDAwMEMifV0%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelReadRpcInterface-3.6.0-querySubCategories?pa…rMUUrNDIrMyoyKzExKzEyKzE5KzUxNyszNDgrM0YrQytFNiJd | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelReadRpcInterface-3.6.0-queryModelProps | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 465 B | 31 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 537 B | 260 ms IModelTileRpcInterface-3.2.0-requestTileTreeProps?…XgiOjEwfX0sIjIyXzFkLUU6MF8weDIwMDAwMDAwMDBjIl0%3D | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | (disk cache) | 1 ms IModelTileRpcInterface-3.2.0-getTileCacheConfig | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 333 B | 31 ms PresentationRpcInterface-4.1.0-getPagedNodes | 200 | h2 | api.bentley.com | fetch | index.ts:102 | 567 B | 721 ms IModelReadRpcInterface-3.6.0-queryRows | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 450 B | 31 ms IModelReadRpcInterface-3.6.0-queryRows | 200 | h2 | api.bentley.com | fetch | WebAppRpcRequest.ts:200 | 367 B | 39 ms

hl662 commented 4 months ago

I'm curious, maybe the redundant requests are coming from a mismanagement of react lifecycle? Maybe the inititalization is being triggered twice (although it might be running twice because of react's StrictMode causing 2 renders every time). You can also compare your implementation of the viewer against the one in the sample app (including the react component that houses the viewer), and not just the same parameters being passed into both implementations