{
- return { error };
- }
-
- public override componentDidUpdate (prevProps: Props) {
- const { error } = this.state;
- const { trigger } = this.props;
-
- if (error !== null && (prevProps.trigger !== trigger)) {
- this.setState({ error: null });
+ useEffect(() => {
+ if (error !== null && trigger) {
+ setError(null);
}
- }
+ }, [error, trigger]);
- #goHome = () => {
- this.setState({ error: null });
+ useEffect(() => {
+ if (propError) {
+ setError(propError);
+ }
+ }, [propError]);
+
+ const goHome = useCallback(() => {
+ setError(null);
window.location.hash = '/';
- };
+ }, [setError]);
- public override render (): React.ReactNode {
- const { children, t } = this.props;
- const { error } = this.state;
-
- return error
- ? (
- <>
- , string>('An error occurred')} />
-
- {t('Something went wrong with the query and rendering of this component. {{message}}', {
- replace: { message: error.message }
- })}
-
-
-
-
-
- >
- )
- : children;
+ if (error) {
+ return (
+ <>
+
+
+ {t('Something went wrong with the query and rendering of this component. {{message}}', {
+ replace: { message: error.message }
+ })}
+
+
+
+
+
+ >
+ );
}
-}
-export default translate(ErrorBoundary);
+ return <>{children}>;
+};
+
+export default ErrorBoundary;
diff --git a/packages/extension-ui/src/messaging.spec.ts b/packages/extension-ui/src/messaging.spec.ts
index d7638871..8cb9dbc5 100644
--- a/packages/extension-ui/src/messaging.spec.ts
+++ b/packages/extension-ui/src/messaging.spec.ts
@@ -1,12 +1,12 @@
// Copyright 2019-2024 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
-///
-
/* global chrome */
import '@polkadot/extension-mocks/chrome';
+import type * as _ from '@polkadot/dev-test/globals.d.ts';
+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import enzyme from 'enzyme';
diff --git a/packages/extension-ui/src/partials/Header.spec.tsx b/packages/extension-ui/src/partials/Header.spec.tsx
index fb3c3186..915631da 100644
--- a/packages/extension-ui/src/partials/Header.spec.tsx
+++ b/packages/extension-ui/src/partials/Header.spec.tsx
@@ -1,11 +1,10 @@
// Copyright 2019-2024 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
-///
-
import '@polkadot/extension-mocks/chrome';
import type { ReactWrapper } from 'enzyme';
+import type * as _ from '@polkadot/dev-test/globals.d.ts';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import enzyme from 'enzyme';
diff --git a/packages/extension-ui/src/util/buildHierarchy.spec.ts b/packages/extension-ui/src/util/buildHierarchy.spec.ts
index fe504fce..ec3bc57b 100644
--- a/packages/extension-ui/src/util/buildHierarchy.spec.ts
+++ b/packages/extension-ui/src/util/buildHierarchy.spec.ts
@@ -1,10 +1,9 @@
// Copyright 2019-2024 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
-///
-
/* eslint-disable jest/expect-expect */
+import type * as _ from '@polkadot/dev-test/globals.d.ts';
import type { AccountJson, AccountWithChildren } from '@polkadot/extension-base/background/types';
import { buildHierarchy } from './buildHierarchy.js';
diff --git a/packages/extension-ui/src/util/nextDerivationPath.spec.ts b/packages/extension-ui/src/util/nextDerivationPath.spec.ts
index ffae2740..aa151837 100644
--- a/packages/extension-ui/src/util/nextDerivationPath.spec.ts
+++ b/packages/extension-ui/src/util/nextDerivationPath.spec.ts
@@ -1,7 +1,7 @@
// Copyright 2019-2024 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
-///
+import type * as _ from '@polkadot/dev-test/globals.d.ts';
import { nextDerivationPath } from './nextDerivationPath.js';
diff --git a/tsconfig.base.json b/tsconfig.base.json
index 59049c5a..848199bd 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -4,7 +4,7 @@
"composite": true,
/* FIXME Dropzone is problematic with nodenext resolution */
"module": "ESNext",
- "moduleResolution": "node",
+ "moduleResolution": "Bundler",
"paths": {
"@polkadot/extension": ["extension/src/index.ts"],
"@polkadot/extension/*": ["extension/src/*.ts"],
diff --git a/yarn.lock b/yarn.lock
index 392d0f62..81c93430 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -63,7 +63,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.23.2":
+"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.23.2":
version: 7.23.2
resolution: "@babel/runtime@npm:7.23.2"
dependencies:
@@ -72,6 +72,15 @@ __metadata:
languageName: node
linkType: hard
+"@babel/runtime@npm:^7.22.5":
+ version: 7.24.7
+ resolution: "@babel/runtime@npm:7.24.7"
+ dependencies:
+ regenerator-runtime: "npm:^0.14.0"
+ checksum: 10/7b77f566165dee62db3db0296e71d08cafda3f34e1b0dcefcd68427272e17c1704f4e4369bff76651b07b6e49d3ea5a0ce344818af9116e9292e4381e0918c76
+ languageName: node
+ linkType: hard
+
"@babel/types@npm:^7.8.3":
version: 7.22.10
resolution: "@babel/types@npm:7.22.10"
@@ -878,6 +887,7 @@ __metadata:
resolution: "@polkadot/extension-base@workspace:packages/extension-base"
dependencies:
"@polkadot/api": "npm:^12.0.2"
+ "@polkadot/dev-test": "npm:^0.79.3"
"@polkadot/extension-chains": "npm:0.48.3-1-x"
"@polkadot/extension-dapp": "npm:0.48.3-1-x"
"@polkadot/extension-inject": "npm:0.48.3-1-x"
@@ -932,6 +942,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@polkadot/extension-dapp@workspace:packages/extension-dapp"
dependencies:
+ "@polkadot/dev-test": "npm:^0.79.3"
"@polkadot/extension-inject": "npm:0.48.3-1-x"
"@polkadot/util": "npm:^12.6.2"
"@polkadot/util-crypto": "npm:^12.6.2"
@@ -948,6 +959,7 @@ __metadata:
resolution: "@polkadot/extension-inject@workspace:packages/extension-inject"
dependencies:
"@polkadot/api": "npm:^12.0.2"
+ "@polkadot/dev-test": "npm:^0.79.3"
"@polkadot/rpc-provider": "npm:^12.0.2"
"@polkadot/types": "npm:^12.0.2"
"@polkadot/util": "npm:^12.6.2"
@@ -982,6 +994,7 @@ __metadata:
"@fortawesome/react-fontawesome": "npm:^0.2.0"
"@paraspell/xcm-analyser": "npm:^1.3.0"
"@polkadot/api": "npm:^12.0.2"
+ "@polkadot/dev-test": "npm:^0.79.3"
"@polkadot/extension-base": "npm:0.48.3-1-x"
"@polkadot/extension-chains": "npm:0.48.3-1-x"
"@polkadot/extension-dapp": "npm:0.48.3-1-x"