Skip to content

Commit cade93c

Browse files
committed
Merge branch 'dev' into chore/contracts-0.8-upgrade
2 parents 93b029b + 6b062e8 commit cade93c

File tree

7 files changed

+590
-633
lines changed

7 files changed

+590
-633
lines changed

.yarn/releases/yarn-4.6.0.cjs renamed to .yarn/releases/yarn-4.8.1.cjs

+346-345
Large diffs are not rendered by default.

.yarnrc.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ compressionLevel: mixed
22

33
enableGlobalCache: false
44

5-
nodeLinker: node-modules
5+
logFilters:
6+
- level: discard
7+
pattern: "*(pde6dc), which doesn't satisfy what react-scripts*"
8+
- level: discard
9+
pattern: "*(p6f2bc), which doesn't satisfy what react-identicons*"
10+
- level: discard
11+
pattern: "*(pca8b0), which doesn't satisfy what react-identicons*"
612

7-
yarnPath: .yarn/releases/yarn-4.6.0.cjs
13+
nodeLinker: node-modules
814

9-
logFilters:
10-
- pattern: "*(pde6dc), which doesn't satisfy what react-scripts*"
11-
level: discard
12-
- pattern: "*(p6f2bc), which doesn't satisfy what react-identicons*"
13-
level: discard
14-
- pattern: "*(pca8b0), which doesn't satisfy what react-identicons*"
15-
level: discard
15+
yarnPath: .yarn/releases/yarn-4.8.1.cjs

contracts/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"eslint": "^9.15.0",
9191
"ethereumjs-util": "^7.1.5",
9292
"ethers": "^6.13.5",
93+
"gluegun": "^5.2.0",
9394
"graphql": "^16.9.0",
9495
"graphql-request": "^7.1.2",
9596
"hardhat": "2.22.19",

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"tsconfig",
2828
"kleros-app"
2929
],
30-
"packageManager": "yarn@4.6.0",
30+
"packageManager": "yarn@4.8.1",
3131
"volta": {
3232
"node": "20.18.3",
33-
"yarn": "4.6.0"
33+
"yarn": "4.8.1"
3434
},
3535
"devDependencies": {
3636
"@commitlint/cli": "^17.8.1",
@@ -75,7 +75,8 @@
7575
"@openzeppelin/contracts-upgradeable@npm:4.8.3": "npm:4.9.6",
7676
"@openzeppelin/contracts-upgradeable@npm:4.9.3": "npm:4.9.6",
7777
"elliptic@npm:6.5.4": "npm:6.6.1",
78-
"word-wrap@npm:~1.2.3": "npm:1.2.5"
78+
"word-wrap@npm:~1.2.3": "npm:1.2.5",
79+
"@codemirror/state": "npm:6.5.2"
7980
},
8081
"scripts": {
8182
"check-prerequisites": "scripts/check-prerequisites.sh",

web-devtools/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"typescript": "^5.6.3"
4848
},
4949
"dependencies": {
50+
"@codemirror/state": "^6.5.2",
5051
"@coinbase/wallet-sdk": "^4.3.2",
5152
"@kleros/kleros-sdk": "workspace:^",
5253
"@kleros/kleros-v2-contracts": "workspace:^",
@@ -69,7 +70,7 @@
6970
"react-use": "^17.5.1",
7071
"styled-components": "^5.3.3",
7172
"typewriter-effect": "^2.21.0",
72-
"vanilla-jsoneditor": "^0.23.0",
73+
"vanilla-jsoneditor": "^3.3.1",
7374
"viem": "^2.24.1",
7475
"wagmi": "^2.14.15"
7576
}

web-devtools/src/components/JSONEditor.tsx

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import React, { useEffect, useRef } from "react";
22
import styled, { css } from "styled-components";
33

4-
import { JSONEditor as Editor } from "vanilla-jsoneditor";
4+
import {
5+
createJSONEditor,
6+
type JSONEditorPropsOptional,
7+
type JsonEditor as VanillaJsonEditor,
8+
} from "vanilla-jsoneditor";
59

610
import { landscapeStyle } from "styles/landscapeStyle";
711

@@ -35,14 +39,13 @@ const Container = styled.div`
3539

3640
const JSONEditor = (props: any) => {
3741
const refContainer = useRef<HTMLDivElement | null>(null);
38-
const refEditor = useRef<Editor | null>(null);
42+
const refEditor = useRef<VanillaJsonEditor | null>(null);
43+
const refPrevProps = useRef<JSONEditorPropsOptional>(props);
3944

4045
useEffect(() => {
41-
refEditor.current = new Editor({
42-
target: refContainer.current!,
43-
props: {
44-
...props,
45-
},
46+
refEditor.current = createJSONEditor({
47+
target: refContainer.current as HTMLDivElement,
48+
props,
4649
});
4750

4851
return () => {
@@ -53,12 +56,25 @@ const JSONEditor = (props: any) => {
5356
};
5457
}, []);
5558

59+
// update props
5660
useEffect(() => {
5761
if (refEditor.current) {
58-
refEditor.current.updateProps(props);
62+
const changedProps = filterUnchangedProps(props, refPrevProps.current);
63+
refEditor.current.updateProps(changedProps);
64+
refPrevProps.current = props;
5965
}
6066
}, [props]);
6167

6268
return <Container ref={refContainer} className={props.className}></Container>;
6369
};
70+
71+
function filterUnchangedProps(
72+
props: JSONEditorPropsOptional,
73+
prevProps: JSONEditorPropsOptional
74+
): JSONEditorPropsOptional {
75+
return Object.fromEntries(
76+
Object.entries(props).filter(([key, value]) => value !== prevProps[key as keyof JSONEditorPropsOptional])
77+
);
78+
}
79+
6480
export default JSONEditor;

0 commit comments

Comments
 (0)