Skip to content

Commit 7571f85

Browse files
fix: dompurify-imprts (#2284)
1 parent 07d1500 commit 7571f85

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

apps/namadillo/src/utils/sdk.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { Sdk } from "@namada/sdk-multicore";
2-
// TODO: The following should work! moduleResolution: "node" prevents this from working.
3-
// import { initSdk } from "@namada/sdk-multicore/inline";
4-
// TODO: Remove the following work-around once the above is fixed!
2+
import { initSdk } from "@namada/sdk-multicore/inline";
53
import { nativeTokenAddressAtom } from "atoms/chain";
64
import { maspIndexerUrlAtom, rpcUrlAtom } from "atoms/settings";
75
import { getDefaultStore } from "jotai";
8-
import { initSdk } from "../../../../node_modules/@namada/sdk-multicore/dist/sdk-multicore/src/initInline";
96

107
const initializeSdk = async (): Promise<Sdk> => {
118
const store = getDefaultStore();

apps/namadillo/src/workers/MaspTxWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Sdk } from "@namada/sdk-multicore";
2+
import { initSdk } from "@namada/sdk-multicore/inline";
23
import {
34
IbcTransferMsgValue,
45
ShieldedTransferMsgValue,
@@ -10,7 +11,6 @@ import BigNumber from "bignumber.js";
1011
import * as Comlink from "comlink";
1112
import { buildTx, EncodedTxData } from "lib/query";
1213
import { namadaAsset, toDisplayAmount } from "utils";
13-
import { initSdk } from "../../../../node_modules/@namada/sdk-multicore/dist/sdk-multicore/src/initInline";
1414
import {
1515
Broadcast,
1616
BroadcastDone,

apps/namadillo/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"jsx": "react-jsx",
1212
"lib": ["dom", "dom.iterable", "esnext"],
1313
"module": "esnext",
14-
"moduleResolution": "node",
14+
"moduleResolution": "bundler",
1515
"noEmit": false,
1616
"noFallthroughCasesInSwitch": true,
1717
"resolveJsonModule": true,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { sanitize } from "isomorphic-dompurify";
1+
import dompurify from "isomorphic-dompurify";
22
import { Location, useLocation } from "react-router-dom";
33

44
export const useSanitizedLocation = (): Location => {
55
const location = useLocation();
66
return {
77
...location,
8-
pathname: sanitize(location.pathname),
9-
search: sanitize(location.search),
10-
hash: sanitize(location.hash),
8+
pathname: dompurify.sanitize(location.pathname),
9+
search: dompurify.sanitize(location.search),
10+
hash: dompurify.sanitize(location.hash),
1111
};
1212
};

packages/hooks/src/useSanitizedParams.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sanitize } from "isomorphic-dompurify";
1+
import dompurify from "isomorphic-dompurify";
22
import { Params, useParams } from "react-router-dom";
33

44
type ParamsT<ParamsOrKey> = Readonly<
@@ -12,7 +12,7 @@ export function useSanitizedParams<
1212
return Object.entries(params).reduce(
1313
(acc, [key, value]) => ({
1414
...acc,
15-
[key]: typeof value === "string" ? sanitize(value) : value,
15+
[key]: typeof value === "string" ? dompurify.sanitize(value) : value,
1616
}),
1717
{} as ParamsT<ParamsOrKey>
1818
);

0 commit comments

Comments
 (0)