A comprehensive list of breaking changes in 3.0 can be found here, iTwin.js 3.0 Changelog.
Authorization has been greatly simplified. Previously the authConfig
prop in the <Viewer />
component would accept a few different options, you could pass in your own AuthClient or config and we'd create one for you. We will no longer create an AuthClient for you, as that should be the responsibility of the App, not the Viewer. Instead, you need to provide your own AuthClient that implements a simpler interface.
interface ViewerAuthorizationClient {
getAccessToken(): Promise<AccessToken>;
readonly onAccessTokenChanged: BeEvent<(token: AccessToken) => void>;
}
In addition, we have removed the header and login/logout buttons from the Create React App web application template in favor of auto-login.
- The
contextId
prop has been renamed toiTwinId
- The
authConfig
prop has been renamed toauthClient
(see Authorization)
The following props have been removed.
uiFrameworkVersion
imjsAppInsightsKey
backend.buddiRegion
backend.buddiServer
The following props are now required.
authClient
enablePerformanceMonitors
In your iTwin App registration, you'll need update your app to add the following scopes:
imodelaccess:read
(Visualization)imodels:read
(Digital Twin Management > iModels)realitydata:read
(Digital Twin Management > Reality Data)
These scopes are no longer required:
itwinjs
openid
email
profile
organization
We've replaced the default measure-tools provided in the Viewer from itwinjs-core with the @itwin/measure-tools-react package.
-
A codemod has been developed to help you upgrade your exisitng code from [email protected] to [email protected].
-
Change the version of
@itwin/web-viewer-react
in your package.json to the following:"dependencies": { ... "@itwin/web-viewer-react": "^2.0.0", ... },
-
React to the breaking changes above.
-
iTwin Viewer for Web
npx create-react-app@latest web-viewer-3 --template @itwin/web-viewer --scripts-version @bentley/react-scripts
-
As of
create-react-app@4
, global installations ofcreate-react-app
are discouraged and can cause issues when bootstrapping a new app from a template. We recommend you uninstall the package usingnpm uninstall -g create-react-app
oryarn global remove create-react-app
to ensure that npx always uses the latest version. -
As of
create-react-app@5
, many users have reported a fatal runtime error, Uncaught ReferenceError: process is not defined. This can be resolved by pinning down the version ofreact-error-overlay
to6.0.9
. Please see the following issue for more information, create-react-app/issues/11773.