- Notifications
You must be signed in to change notification settings - Fork 50
Support for Gated Dispute Kits and other improvements #2050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ Deploy Preview for kleros-v2-neo failed. Why did it fail? →
|
| """ WalkthroughThe changes replace ID- and environment-based dispute kit identification with a static enum and address-based logic. New hooks and types support dispute kit data, including gated kits. Several components are refactored to use address-based dispute kit resolution and to handle extra data for gated kits. UI enhancements enable auto-focusing and gated kit parameter entry. Changes
Sequence Diagram(s)sequenceDiagram participant UI_Component participant useDisputeKitAddresses participant ContractsJSON participant DisputeKitsEnum UI_Component->>useDisputeKitAddresses: Provide disputeKitAddress useDisputeKitAddresses->>ContractsJSON: Load contract addresses for current chain useDisputeKitAddresses->>DisputeKitsEnum: Match address to enum value useDisputeKitAddresses-->>UI_Component: Return {disputeKitName, isLoading, error} sequenceDiagram participant CourtComponent participant User participant State participant prepareArbitratorExtradata User->>CourtComponent: Select dispute kit (possibly gated) CourtComponent->>State: Update isGatedDisputeKit, disputeKitData User->>CourtComponent: Enter token address/ID if gated CourtComponent->>prepareArbitratorExtradata: Prepare extradata with disputeKitData Estimated code review effort4 (~90 minutes) Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File ( |
❌ Deploy Preview for kleros-v2-university failed. Why did it fail? →
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
web/src/consts/index.ts(1 hunks)web/src/context/NewDisputeContext.tsx(1 hunks)web/src/hooks/queries/useDisputeDetailsQuery.ts(1 hunks)web/src/hooks/queries/useSupportedDisputeKits.ts(2 hunks)web/src/hooks/useDisputeKitAddresses.ts(1 hunks)web/src/pages/Cases/CaseDetails/Appeal/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Voting/index.tsx(3 hunks)web/src/pages/Resolver/Briefing/Description.tsx(4 hunks)web/src/pages/Resolver/Briefing/Title.tsx(3 hunks)web/src/pages/Resolver/NavigationButtons/SubmitBatchDisputesButton.tsx(1 hunks)web/src/pages/Resolver/NavigationButtons/SubmitDisputeButton.tsx(1 hunks)web/src/pages/Resolver/Parameters/Category.tsx(3 hunks)web/src/pages/Resolver/Parameters/Court.tsx(2 hunks)web/src/pages/Resolver/Parameters/VotingOptions/index.tsx(3 hunks)web/src/utils/prepareArbitratorExtradata.ts(1 hunks)
🧠 Learnings (16)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/hooks/queries/useDisputeDetailsQuery.ts (12)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1727
File: web/src/utils/atlas/updateEmail.ts:34-37
Timestamp: 2024-10-28T12:20:19.884Z
Learning: In web/src/utils/atlas/updateEmail.ts, the error coming from the GraphQLError array already has the necessary structure, so additional specificity in error handling is unnecessary.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
web/src/pages/Resolver/NavigationButtons/SubmitBatchDisputesButton.tsx (10)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:25-25
Timestamp: 2024-10-22T09:35:14.098Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, for the AbiCallMapping type, it's acceptable to use args: any[] since args can be anything.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
Learnt from: Harman-singh-waraich
PR: #1727
File: web/src/context/AtlasProvider.tsx:159-171
Timestamp: 2024-10-29T06:46:13.522Z
Learning: Both SubmitEvidenceModal.tsx and Policy/index.tsx use the uploadFile function from AtlasProvider, which includes the fetchWithAuthErrorHandling error handling utility.
web/src/pages/Resolver/Briefing/Title.tsx (12)
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/pages/Resolver/Briefing/Description.tsx (13)
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: alcercu
PR: #1582
File: web-devtools/src/context/RulerContext.tsx:50-59
Timestamp: 2024-10-14T10:25:48.452Z
Learning: In React, setter functions returned by useState are stable between renders and don't need to be included in the dependency array of useEffect hooks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In this project, JSDoc documentation is considered unnecessary for React components.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/hooks/queries/useSupportedDisputeKits.ts (12)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1850
File: web/src/context/GraphqlBatcher.tsx:25-41
Timestamp: 2025-01-27T11:25:08.246Z
Learning: In GraphQL batch operations using Promise.all, individual request errors should be caught and handled (e.g., returning {data: {}}) rather than thrown, to prevent a single failure from causing the entire batch to fail.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/fetchDisputeDetails.ts:14-27
Timestamp: 2024-10-23T14:05:15.987Z
Learning: Avoid using graphql-request in built libraries as it behaves unexpectedly.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-17
Timestamp: 2024-11-19T16:09:41.467Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (ID: 1) can have its parent ID set to itself ("parent": 1), as there is no parent court with ID 0 currently.
web/src/pages/Resolver/Parameters/VotingOptions/index.tsx (14)
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
web/src/pages/Resolver/Parameters/Category.tsx (11)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/pages/Resolver/NavigationButtons/SubmitDisputeButton.tsx (10)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
web/src/pages/Cases/CaseDetails/Appeal/index.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:233-233
Timestamp: 2024-10-09T10:19:11.816Z
Learning: In 'web-devtools/src/app/(main)/ruler/RulingModes.tsx', the label 'Random Preset' is correct and should not be changed to 'Automatic Random'.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
web/src/pages/Cases/CaseDetails/Voting/index.tsx (15)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: kemuru
PR: #1994
File: web/vite.config.js:26-33
Timestamp: 2025-05-23T17:47:39.947Z
Learning: The viteStaticCopy plugin configuration in web/vite.config.js correctly copies Shutter SDK files from the installed node_modules location. The path resolve(__dirname, "../node_modules/@shutter-network/shutter-sdk/dist/*") works when dependencies are properly installed, despite initial analysis suggesting otherwise due to sandbox environment limitations.
web/src/consts/index.ts (11)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/context/NewDisputeContext.tsx (7)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
web/src/utils/prepareArbitratorExtradata.ts (6)
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:22-22
Timestamp: 2024-10-22T09:34:54.761Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiCallMapping is intentionally typed as string because it is parsed later in the action functions.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
web/src/hooks/useDisputeKitAddresses.ts (11)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1762
File: web/src/utils/parseWagmiError.ts:10-17
Timestamp: 2024-11-29T06:23:15.955Z
Learning: In the web/src/utils/parseWagmiError.ts file and throughout the codebase, prefer using optional chaining to handle undefined or null values, including optional arrays, without adding explicit existence or length checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
web/src/pages/Resolver/Parameters/Court.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/hooks/queries/useDisputeDetailsQuery.ts (12)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1727
File: web/src/utils/atlas/updateEmail.ts:34-37
Timestamp: 2024-10-28T12:20:19.884Z
Learning: In web/src/utils/atlas/updateEmail.ts, the error coming from the GraphQLError array already has the necessary structure, so additional specificity in error handling is unnecessary.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
web/src/pages/Resolver/NavigationButtons/SubmitBatchDisputesButton.tsx (10)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:25-25
Timestamp: 2024-10-22T09:35:14.098Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, for the AbiCallMapping type, it's acceptable to use args: any[] since args can be anything.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
Learnt from: Harman-singh-waraich
PR: #1727
File: web/src/context/AtlasProvider.tsx:159-171
Timestamp: 2024-10-29T06:46:13.522Z
Learning: Both SubmitEvidenceModal.tsx and Policy/index.tsx use the uploadFile function from AtlasProvider, which includes the fetchWithAuthErrorHandling error handling utility.
web/src/pages/Resolver/Briefing/Title.tsx (12)
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/pages/Resolver/Briefing/Description.tsx (13)
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: alcercu
PR: #1582
File: web-devtools/src/context/RulerContext.tsx:50-59
Timestamp: 2024-10-14T10:25:48.452Z
Learning: In React, setter functions returned by useState are stable between renders and don't need to be included in the dependency array of useEffect hooks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In this project, JSDoc documentation is considered unnecessary for React components.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/hooks/queries/useSupportedDisputeKits.ts (12)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1850
File: web/src/context/GraphqlBatcher.tsx:25-41
Timestamp: 2025-01-27T11:25:08.246Z
Learning: In GraphQL batch operations using Promise.all, individual request errors should be caught and handled (e.g., returning {data: {}}) rather than thrown, to prevent a single failure from causing the entire batch to fail.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/fetchDisputeDetails.ts:14-27
Timestamp: 2024-10-23T14:05:15.987Z
Learning: Avoid using graphql-request in built libraries as it behaves unexpectedly.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-17
Timestamp: 2024-11-19T16:09:41.467Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (ID: 1) can have its parent ID set to itself ("parent": 1), as there is no parent court with ID 0 currently.
web/src/pages/Resolver/Parameters/VotingOptions/index.tsx (14)
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
web/src/pages/Resolver/Parameters/Category.tsx (11)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-09-27T10:07:54.013Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1694
File: web-devtools/package.json:33-35
Timestamp: 2024-10-08T16:23:56.291Z
Learning: react-toastify is used in the web-devtools project, particularly in layout.tsx, and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
web/src/pages/Resolver/NavigationButtons/SubmitDisputeButton.tsx (10)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
web/src/pages/Cases/CaseDetails/Appeal/index.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:233-233
Timestamp: 2024-10-09T10:19:11.816Z
Learning: In 'web-devtools/src/app/(main)/ruler/RulingModes.tsx', the label 'Random Preset' is correct and should not be changed to 'Automatic Random'.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
web/src/pages/Cases/CaseDetails/Voting/index.tsx (15)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: kemuru
PR: #1994
File: web/vite.config.js:26-33
Timestamp: 2025-05-23T17:47:39.947Z
Learning: The viteStaticCopy plugin configuration in web/vite.config.js correctly copies Shutter SDK files from the installed node_modules location. The path resolve(__dirname, "../node_modules/@shutter-network/shutter-sdk/dist/*") works when dependencies are properly installed, despite initial analysis suggesting otherwise due to sandbox environment limitations.
web/src/consts/index.ts (11)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: kemuru
PR: #1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-07T06:18:23.427Z
Learning: In the kleros-v2 codebase, the property totalResolvedDisputes should remain and should not be renamed to totalResolvedVotes.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/context/NewDisputeContext.tsx (7)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
web/src/utils/prepareArbitratorExtradata.ts (6)
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:22-22
Timestamp: 2024-10-22T09:34:54.761Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiCallMapping is intentionally typed as string because it is parsed later in the action functions.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
web/src/hooks/useDisputeKitAddresses.ts (11)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1762
File: web/src/utils/parseWagmiError.ts:10-17
Timestamp: 2024-11-29T06:23:15.955Z
Learning: In the web/src/utils/parseWagmiError.ts file and throughout the codebase, prefer using optional chaining to handle undefined or null values, including optional arrays, without adding explicit existence or length checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
web/src/pages/Resolver/Parameters/Court.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: contracts-testing
- GitHub Check: Analyze (javascript)
🔇 Additional comments (13)
web/src/consts/index.ts (1)
46-51: LGTM! Excellent architectural improvement.The replacement of dynamic ID-based dispute kit identification with a static enum is a solid design choice that centralizes naming, improves predictability, and supports the new address-based identification approach. The addition of
GatedandGatedShutterdispute kits aligns perfectly with the PR objectives.web/src/hooks/queries/useDisputeDetailsQuery.ts (1)
33-33: LGTM! Essential addition for address-based dispute kit handling.Adding the
addressfield to the GraphQL query enables the new address-based dispute kit identification approach, which is a key component of this PR's improvements.web/src/pages/Resolver/NavigationButtons/SubmitBatchDisputesButton.tsx (1)
55-56: LGTM! Correctly implements support for gated dispute kit data.The addition of
disputeData.disputeKitDataas the fourth parameter enables encoding of dispute kit-specific data, which is essential for supporting gated dispute kits. The change aligns well with the updatedprepareArbitratorExtradatafunction signature.web/src/hooks/queries/useSupportedDisputeKits.ts (1)
13-13: LGTM! Consistent with the address-based dispute kit approach.Adding the
addressfield to thesupportedDisputeKitsquery complements the similar change inuseDisputeDetailsQueryand enables comprehensive address-based dispute kit identification across the application.web/src/pages/Resolver/Briefing/Description.tsx (1)
1-1: LGTM! Well-implemented UX enhancement.The auto-focus functionality is cleanly implemented using React best practices. The
useEffectwith empty dependency array runs once on mount, safely queries for the textarea element, and focuses it appropriately. This improves the user experience during dispute resolution setup.Also applies to: 33-33, 39-46, 49-49
web/src/pages/Resolver/Briefing/Title.tsx (1)
1-1: LGTM! Clean auto-focus implementation.The automatic focus functionality is well-implemented using standard React patterns. The
useRefhook provides DOM access, and theuseEffectwith an empty dependency array ensures the focus happens only once on mount. This enhances accessibility and user experience.Also applies to: 39-39, 45-52, 55-55
web/src/pages/Resolver/Parameters/VotingOptions/index.tsx (1)
1-1: LGTM! Consistent auto-focus implementation.The auto-focus implementation follows the same clean pattern as other resolver components, improving user experience by automatically focusing the primary input field on component mount.
Also applies to: 42-42, 48-55, 58-58
web/src/pages/Resolver/NavigationButtons/SubmitDisputeButton.tsx (1)
58-60: LGTM! Proper integration of dispute kit data.The addition of
disputeData.disputeKitDataas a fourth parameter toprepareArbitratorExtradatacorrectly supports the enhanced dispute kit functionality, including gated dispute kits as mentioned in the PR objectives.web/src/pages/Resolver/Parameters/Category.tsx (1)
1-1: LGTM! Consistent auto-focus pattern maintained.The auto-focus implementation is consistent with other resolver parameter components, maintaining a unified user experience across the dispute resolution workflow.
Also applies to: 43-43, 49-56, 59-59
web/src/pages/Cases/CaseDetails/Appeal/index.tsx (1)
7-7: LGTM! Improved dispute kit identification approach.The refactor from ID-based substring matching to address-based exact matching with enum constants is a significant improvement:
- More precise matching eliminates potential edge cases from substring checks
- Better type safety using
DisputeKitsenum constants- Address-based identification aligns with the PR's architectural changes
- Cleaner, more maintainable code structure
This change supports the PR's objective of enabling better dispute kit handling and identification.
Also applies to: 9-9, 54-57
web/src/pages/Cases/CaseDetails/Voting/index.tsx (1)
73-76: LGTM! Clean refactor to address-based dispute kit identificationThe change from ID-based to address-based dispute kit identification is well-implemented. The code properly handles the optional dispute kit address and uses the new hook to get the human-readable name.
web/src/context/NewDisputeContext.tsx (1)
57-70: Well-structured type definitions for dispute kit dataThe introduction of the
IDisputeKitDataunion type and specific interfaces for gated and future dispute kits provides good extensibility. The gated dispute kit data structure properly captures token gating requirements.web/src/pages/Resolver/Parameters/Court.tsx (1)
110-118: Dispute kit auto-selection is safe and doesn’t override any user-stored preference
TheselectedDisputeKitIdis derived fromdisputeData.disputeKitId(on-chain data), and there’s no client-side persistence (e.g.localStorage) for a user’s dispute kit choice in the codebase. You can ignore this warning.Likely an incorrect or invalid review comment.
| import { useEffect, useState } from "react"; | ||
| | ||
| import { useChainId } from "wagmi"; | ||
| | ||
| import { DisputeKits } from "consts/index"; | ||
| | ||
| interface UseDisputeKitAddressesParams { | ||
| disputeKitAddress?: string; | ||
| } | ||
| | ||
| interface UseDisputeKitAddressesAllReturn { | ||
| availableDisputeKits: Record<string, DisputeKits>; | ||
| isLoading: boolean; | ||
| error: string | null; | ||
| } | ||
| | ||
| const DISPUTE_KIT_CONFIG = { | ||
| [DisputeKits.Classic]: "disputeKitClassicAddress", | ||
| [DisputeKits.Shutter]: "disputeKitShutterAddress", | ||
| [DisputeKits.Gated]: "disputeKitGatedAddress", | ||
| [DisputeKits.GatedShutter]: "disputeKitGatedShutterAddress", | ||
| } as const; | ||
| | ||
| /** | ||
| * Hook to get dispute kit name based on address | ||
| * @param disputeKitAddress - Optional specific dispute kit address to identify | ||
| * @returns The human-readable name of the dispute kit and loading state | ||
| */ | ||
| export const useDisputeKitAddresses = ({ disputeKitAddress }: UseDisputeKitAddressesParams = {}) => { | ||
| const chainId = useChainId(); | ||
| const [disputeKitName, setDisputeKitName] = useState<DisputeKits | undefined>(undefined); | ||
| const [isLoading, setIsLoading] = useState(true); | ||
| const [error, setError] = useState<string | null>(null); | ||
| | ||
| useEffect(() => { | ||
| const loadDisputeKitName = async () => { | ||
| try { | ||
| setIsLoading(true); | ||
| setError(null); | ||
| | ||
| // If no dispute kit address is provided, we can't determine the type | ||
| if (!disputeKitAddress) { | ||
| setDisputeKitName(undefined); | ||
| setIsLoading(false); | ||
| return; | ||
| } | ||
| | ||
| // If no chainId, we can't look up from generated contracts | ||
| if (!chainId) { | ||
| setDisputeKitName(undefined); | ||
| setIsLoading(false); | ||
| return; | ||
| } | ||
| | ||
| // Dynamic import to handle cases where generated contracts might not be available | ||
| try { | ||
| const generatedContracts = await import("hooks/contracts/generated"); | ||
| | ||
| // Check each dispute kit to see if the address matches | ||
| for (const [humanName, contractKey] of Object.entries(DISPUTE_KIT_CONFIG)) { | ||
| const addressMapping = generatedContracts[contractKey as keyof typeof generatedContracts]; | ||
| | ||
| if (addressMapping && typeof addressMapping === "object" && chainId in addressMapping) { | ||
| const contractAddress = addressMapping[chainId as keyof typeof addressMapping] as string; | ||
| if ( | ||
| contractAddress && | ||
| typeof contractAddress === "string" && | ||
| contractAddress.toLowerCase() === disputeKitAddress.toLowerCase() | ||
| ) { | ||
| setDisputeKitName(humanName as DisputeKits); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
| | ||
| // If no address matches, return undefined | ||
| setDisputeKitName(undefined); | ||
| } catch { | ||
| // If we can't import generated contracts, return undefined | ||
| setDisputeKitName(undefined); | ||
| } | ||
| } catch (err) { | ||
| console.error("Failed to determine dispute kit name:", err); | ||
| setError("Failed to determine dispute kit type"); | ||
| setDisputeKitName(undefined); | ||
| } finally { | ||
| setIsLoading(false); | ||
| } | ||
| }; | ||
| | ||
| loadDisputeKitName(); | ||
| }, [chainId, disputeKitAddress]); | ||
| | ||
| return { | ||
| disputeKitName, | ||
| isLoading, | ||
| error, | ||
| }; | ||
| }; | ||
| | ||
| /** | ||
| * Hook to get all dispute kit addresses for the current chain | ||
| * @returns All dispute kit addresses, loading state, and error state | ||
| */ | ||
| export const useDisputeKitAddressesAll = (): UseDisputeKitAddressesAllReturn => { | ||
| const chainId = useChainId(); | ||
| const [availableDisputeKits, setAvailableDisputeKits] = useState<Record<string, DisputeKits>>({}); | ||
| const [isLoading, setIsLoading] = useState(true); | ||
| const [error, setError] = useState<string | null>(null); | ||
| | ||
| useEffect(() => { | ||
| const loadAllDisputeKitAddresses = async () => { | ||
| try { | ||
| setIsLoading(true); | ||
| setError(null); | ||
| | ||
| // If no chainId, we can't look up from generated contracts | ||
| if (!chainId) { | ||
| setAvailableDisputeKits({}); | ||
| setIsLoading(false); | ||
| return; | ||
| } | ||
| | ||
| // Dynamic import to handle cases where generated contracts might not be available | ||
| try { | ||
| const generatedContracts = await import("hooks/contracts/generated"); | ||
| const newAvailableDisputeKits: Record<string, DisputeKits> = {}; | ||
| | ||
| // Iterate through all dispute kits and get their addresses | ||
| for (const [humanName, contractKey] of Object.entries(DISPUTE_KIT_CONFIG)) { | ||
| const addressMapping = generatedContracts[contractKey as keyof typeof generatedContracts]; | ||
| | ||
| if (addressMapping && typeof addressMapping === "object" && chainId in addressMapping) { | ||
| const contractAddress = addressMapping[chainId as keyof typeof addressMapping] as string; | ||
| if (contractAddress && typeof contractAddress === "string") { | ||
| newAvailableDisputeKits[contractAddress.toLowerCase()] = humanName as DisputeKits; | ||
| } | ||
| } | ||
| } | ||
| | ||
| setAvailableDisputeKits(newAvailableDisputeKits); | ||
| } catch { | ||
| // If we can't import generated contracts, return empty object | ||
| setAvailableDisputeKits({}); | ||
| } | ||
| } catch (err) { | ||
| console.error("Failed to load dispute kit addresses:", err); | ||
| setError("Failed to load dispute kit addresses"); | ||
| setAvailableDisputeKits({}); | ||
| } finally { | ||
| setIsLoading(false); | ||
| } | ||
| }; | ||
| | ||
| loadAllDisputeKitAddresses(); | ||
| }, [chainId]); | ||
| | ||
| return { | ||
| availableDisputeKits, | ||
| isLoading, | ||
| error, | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider adding unit tests for the new hooks
These hooks contain critical logic for dispute kit identification and would benefit from comprehensive unit tests to ensure reliability.
Would you like me to generate unit tests for these hooks or open an issue to track this task?
🤖 Prompt for AI Agents
In web/src/hooks/useDisputeKitAddresses.ts from lines 1 to 163, the new hooks useDisputeKitAddresses and useDisputeKitAddressesAll lack unit tests. To fix this, create comprehensive unit tests covering various scenarios such as valid and invalid dispute kit addresses, missing chainId, and error handling during dynamic imports. Use a testing framework like Jest with React Testing Library to mock dependencies like useChainId and the dynamic import of generated contracts, ensuring the hooks behave correctly and handle loading and error states as expected. | } catch { | ||
| // If we can't import generated contracts, return undefined | ||
| setDisputeKitName(undefined); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Empty catch block suppresses errors silently
The empty catch block could hide important errors during development.
Log the error for debugging purposes:
- } catch { + } catch (importError) { + console.warn('Failed to import generated contracts:', importError); // If we can't import generated contracts, return undefined setDisputeKitName(undefined); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch { | |
| // If we can't import generated contracts, return undefined | |
| setDisputeKitName(undefined); | |
| } | |
| } catch (importError) { | |
| console.warn('Failed to import generated contracts:', importError); | |
| // If we can't import generated contracts, return undefined | |
| setDisputeKitName(undefined); | |
| } |
🤖 Prompt for AI Agents
In web/src/hooks/useDisputeKitAddresses.ts around lines 78 to 81, the catch block is empty and silently suppresses errors. Modify the catch block to accept the error object and log it using console.error or a similar logging method to ensure errors are visible during development and debugging. | } catch { | ||
| // If we can't import generated contracts, return empty object | ||
| setAvailableDisputeKits({}); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Empty catch block suppresses errors silently
The empty catch block could hide important errors during development.
Log the error for debugging purposes:
- } catch { + } catch (importError) { + console.warn('Failed to import generated contracts:', importError); // If we can't import generated contracts, return empty object setAvailableDisputeKits({}); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch { | |
| // If we can't import generated contracts, return empty object | |
| setAvailableDisputeKits({}); | |
| } | |
| } catch (importError) { | |
| console.warn('Failed to import generated contracts:', importError); | |
| // If we can't import generated contracts, return empty object | |
| setAvailableDisputeKits({}); | |
| } |
🤖 Prompt for AI Agents
In web/src/hooks/useDisputeKitAddresses.ts around lines 142 to 145, the catch block is empty and silently suppresses errors, which can hide important issues during development. Modify the catch block to log the caught error before setting available dispute kits to an empty object. This will help in debugging by making the error visible in the console or logs. | | ||
| import { responsiveSize } from "styles/responsiveSize"; | ||
| import { landscapeStyle } from "styles/landscapeStyle"; | ||
| import { responsiveSize } from "styles/responsiveSize"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import detected
The responsiveSize import is not used anywhere in this file.
Remove the unused import:
-import { responsiveSize } from "styles/responsiveSize";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { responsiveSize } from "styles/responsiveSize"; |
🤖 Prompt for AI Agents
In web/src/pages/Cases/CaseDetails/Voting/index.tsx at line 23, the import statement for responsiveSize is unused. Remove the entire line importing responsiveSize to clean up the code and avoid unnecessary imports. There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
web/src/pages/Resolver/Parameters/Court.tsx (2)
143-165: Add type guards for safe type assertions.The type assertions to
IGatedDisputeDatashould include runtime type validation to prevent potential runtime errors.Add type guard validation before casting:
const handleTokenAddressChange = (event: React.ChangeEvent<HTMLInputElement>) => { + if (disputeData.disputeKitData?.type !== 'gated') return; const currentData = disputeData.disputeKitData as IGatedDisputeData;Apply similar checks to
handleERC1155TokenChangeandhandleTokenIdChange.
173-173: Address the non-null assertion operator usage.The use of the non-null assertion operator (
!) can lead to runtime errors if the assumption is incorrect.Use safer extraction:
- onSelect={(path: string | number) => typeof path === "string" && handleCourtChange(path.split("/").pop()!)} + onSelect={(path: string | number) => { + if (typeof path === "string") { + const courtId = path.split("/").pop(); + if (courtId) handleCourtChange(courtId); + } + }}
🧹 Nitpick comments (1)
web/src/utils/extradataToTokenInfo.ts (1)
25-31: Consider adding constants for magic numbers.The byte offsets (96, 128, 160) are magic numbers that could benefit from named constants for better maintainability and documentation.
+// Smart contract storage slot offsets +const PACKED_TOKEN_GATE_OFFSET = 96; +const PACKED_TOKEN_GATE_END = 128; +const TOKEN_ID_OFFSET = 128; +const TOKEN_ID_END = 160; +const MIN_EXTRADATA_LENGTH = 160; - if (extraDataBytes.length < 160) { + if (extraDataBytes.length < MIN_EXTRADATA_LENGTH) { - const packedBytes = extraDataBytes.slice(96, 128); + const packedBytes = extraDataBytes.slice(PACKED_TOKEN_GATE_OFFSET, PACKED_TOKEN_GATE_END); - const tokenIdBytes = extraDataBytes.slice(128, 160); + const tokenIdBytes = extraDataBytes.slice(TOKEN_ID_OFFSET, TOKEN_ID_END);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
web/src/hooks/queries/useRoundDetailsQuery.ts(1 hunks)web/src/pages/Resolver/Landing/index.tsx(3 hunks)web/src/pages/Resolver/Parameters/Court.tsx(2 hunks)web/src/utils/extradataToTokenInfo.ts(1 hunks)web/src/utils/prepareArbitratorExtradata.ts(1 hunks)
🧠 Learnings (4)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/hooks/queries/useRoundDetailsQuery.ts (4)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
web/src/pages/Resolver/Landing/index.tsx (14)
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
web/src/pages/Resolver/Parameters/Court.tsx (24)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-5
Timestamp: 2024-11-19T17:18:39.007Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (id: 1) intentionally references itself as its parent ("parent": 1). This self-reference is acceptable and should not be flagged as an issue in future reviews.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/dispute-template/page.tsx:324-360
Timestamp: 2024-10-09T10:17:37.935Z
Learning: In this codebase, prefer using the ?? (nullish coalescing operator) over || when handling default values for optional properties in React components.
Learnt from: Harman-singh-waraich
PR: #1762
File: web/src/utils/parseWagmiError.ts:10-17
Timestamp: 2024-11-29T06:23:15.955Z
Learning: In the web/src/utils/parseWagmiError.ts file and throughout the codebase, prefer using optional chaining to handle undefined or null values, including optional arrays, without adding explicit existence or length checks.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:179-199
Timestamp: 2024-10-09T10:18:51.089Z
Learning: In web-devtools/src/app/(main)/ruler/RulingModes.tsx, the handleUpdate function already handles errors via wrapWithToast, so additional error handling is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypeValidators.ts:12-0
Timestamp: 2024-10-22T10:09:13.280Z
Learning: The validateMapping function in actionTypeValidators.ts already checks for required fields and throws an InvalidMappingError if they are missing, so adding type checks before casting to specific mapping types is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: Variable validation occurs dynamically within the executeActions function in kleros-sdk/src/dataMappings/executeActions.ts. If variables are missing, executeActions will throw errors to prompt the consumer to provide the missing variables.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/hooks/useSessionStorage.ts:3-12
Timestamp: 2024-11-21T05:38:11.576Z
Learning: In the useSessionStorage hook in kleros-app/src/lib/atlas/hooks/useSessionStorage.ts, the error handling in the catch block covers cases where window is undefined or sessionStorage throws an exception, so additional checks are unnecessary.
Learnt from: Harman-singh-waraich
PR: #1654
File: web/src/pages/Settings/EmailConfirmation/index.tsx:93-119
Timestamp: 2024-10-03T12:15:55.043Z
Learning: In the email confirmation component, an invalid link message is already displayed when the address is invalid or the token is missing. The useEffect should simply avoid making the call when the address is invalid or missing.
Learnt from: Harman-singh-waraich
PR: #1654
File: web/src/pages/Settings/EmailConfirmation/index.tsx:93-119
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the email confirmation component, an invalid link message is already displayed when the address is invalid or the token is missing. The useEffect should simply avoid making the call when the address is invalid or missing.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/utils/addUser.ts:18-37
Timestamp: 2024-11-21T06:14:26.307Z
Learning: In the kleros-app/src/lib/atlas/utils/addUser.ts file, email format validation is performed by the server in the addUser function. The library does not include client-side email validation, and it's the responsibility of the library consumers to perform any pre-checks if desired.
Learnt from: jaybuidl
PR: #1620
File: contracts/test/arbitration/draw.ts:84-84
Timestamp: 2024-11-05T11:32:11.238Z
Learning: In TypeScript code using ethers.js version 6, contract.target should be used instead of contract.address to access a contract's address.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-17
Timestamp: 2024-11-19T16:09:41.467Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (ID: 1) can have its parent ID set to itself ("parent": 1), as there is no parent court with ID 0 currently.
🧬 Code Graph Analysis (1)
web/src/pages/Resolver/Landing/index.tsx (1)
web/src/utils/extradataToTokenInfo.ts (1)
extraDataToTokenInfo(14-45)
🚧 Files skipped from review as they are similar to previous changes (1)
- web/src/utils/prepareArbitratorExtradata.ts
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/hooks/queries/useRoundDetailsQuery.ts (4)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
web/src/pages/Resolver/Landing/index.tsx (14)
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: In the Kleros SDK, when using the populateTemplate function in kleros-sdk/src/utils/getDispute.ts, missing variables in Mustache templates are acceptable. Mustache fills in blanks, and it's preferable to return the partially populated template without throwing errors, as it's still helpful for the consumer.
web/src/pages/Resolver/Parameters/Court.tsx (24)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-5
Timestamp: 2024-11-19T17:18:39.007Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (id: 1) intentionally references itself as its parent ("parent": 1). This self-reference is acceptable and should not be flagged as an issue in future reviews.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/dispute-template/page.tsx:324-360
Timestamp: 2024-10-09T10:17:37.935Z
Learning: In this codebase, prefer using the ?? (nullish coalescing operator) over || when handling default values for optional properties in React components.
Learnt from: Harman-singh-waraich
PR: #1762
File: web/src/utils/parseWagmiError.ts:10-17
Timestamp: 2024-11-29T06:23:15.955Z
Learning: In the web/src/utils/parseWagmiError.ts file and throughout the codebase, prefer using optional chaining to handle undefined or null values, including optional arrays, without adding explicit existence or length checks.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:179-199
Timestamp: 2024-10-09T10:18:51.089Z
Learning: In web-devtools/src/app/(main)/ruler/RulingModes.tsx, the handleUpdate function already handles errors via wrapWithToast, so additional error handling is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypeValidators.ts:12-0
Timestamp: 2024-10-22T10:09:13.280Z
Learning: The validateMapping function in actionTypeValidators.ts already checks for required fields and throws an InvalidMappingError if they are missing, so adding type checks before casting to specific mapping types is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:43-43
Timestamp: 2024-10-14T15:29:32.954Z
Learning: Variable validation occurs dynamically within the executeActions function in kleros-sdk/src/dataMappings/executeActions.ts. If variables are missing, executeActions will throw errors to prompt the consumer to provide the missing variables.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/hooks/useSessionStorage.ts:3-12
Timestamp: 2024-11-21T05:38:11.576Z
Learning: In the useSessionStorage hook in kleros-app/src/lib/atlas/hooks/useSessionStorage.ts, the error handling in the catch block covers cases where window is undefined or sessionStorage throws an exception, so additional checks are unnecessary.
Learnt from: Harman-singh-waraich
PR: #1654
File: web/src/pages/Settings/EmailConfirmation/index.tsx:93-119
Timestamp: 2024-10-03T12:15:55.043Z
Learning: In the email confirmation component, an invalid link message is already displayed when the address is invalid or the token is missing. The useEffect should simply avoid making the call when the address is invalid or missing.
Learnt from: Harman-singh-waraich
PR: #1654
File: web/src/pages/Settings/EmailConfirmation/index.tsx:93-119
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the email confirmation component, an invalid link message is already displayed when the address is invalid or the token is missing. The useEffect should simply avoid making the call when the address is invalid or missing.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/utils/addUser.ts:18-37
Timestamp: 2024-11-21T06:14:26.307Z
Learning: In the kleros-app/src/lib/atlas/utils/addUser.ts file, email format validation is performed by the server in the addUser function. The library does not include client-side email validation, and it's the responsibility of the library consumers to perform any pre-checks if desired.
Learnt from: jaybuidl
PR: #1620
File: contracts/test/arbitration/draw.ts:84-84
Timestamp: 2024-11-05T11:32:11.238Z
Learning: In TypeScript code using ethers.js version 6, contract.target should be used instead of contract.address to access a contract's address.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: jaybuidl
PR: #1746
File: contracts/config/courts.v2.mainnet-neo.json:3-17
Timestamp: 2024-11-19T16:09:41.467Z
Learning: In contracts/config/courts.v2.mainnet-neo.json, the General Court (ID: 1) can have its parent ID set to itself ("parent": 1), as there is no parent court with ID 0 currently.
🧬 Code Graph Analysis (1)
web/src/pages/Resolver/Landing/index.tsx (1)
web/src/utils/extradataToTokenInfo.ts (1)
extraDataToTokenInfo(14-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: contracts-testing
- GitHub Check: Analyze (javascript)
- GitHub Check: Mend Security Check
🔇 Additional comments (8)
web/src/hooks/queries/useRoundDetailsQuery.ts (1)
20-26: LGTM! Clean GraphQL query extension.The nested query structure correctly fetches
extraDatafromClassicDisputefragments, which integrates well with the gated dispute kit functionality implemented in other components.web/src/pages/Resolver/Landing/index.tsx (2)
72-77: LGTM! Proper memoization of gated token info extraction.The
useMemohook correctly extracts and processesextraDatafrom the round query results, with appropriate null checks and proper dependency management.
125-125: LGTM! Clean conditional integration of gated dispute kit data.The disputeKitData is properly set with the
type: "gated"field when gated token info is available, maintaining type safety and data structure consistency.web/src/utils/extradataToTokenInfo.ts (3)
17-23: LGTM! Proper error handling for insufficient data.The early return with default values when
extraDataBytes.length < 160provides good fallback behavior for malformed or incomplete data.
33-38: LGTM! Correct bit manipulation for token data extraction.The bitwise operations properly extract the token gate address (lower 160 bits) and ERC1155 flag (bit 160) from the packed data, with appropriate masking and padding.
27-27: Ensure Buffer compatibility in browser buildsWe’ve confirmed that:
bufferis declared in package.json,Buffer.from(...)is used twice in web/src/utils/extradataToTokenInfo.ts (forpackedBytesandtokenIdBytes).Please verify that your bundler (Webpack, Vite, etc.) is configured to polyfill Node’s Buffer at runtime. If not, you can either:
- Add a fallback for Buffer in your build config, or
- Replace both Buffer usages with viem’s
toHex(no polyfill needed):import { toHex } from 'viem' // Slot 4 (bytes 96–127) const packedHex = toHex(packedBytes, { pad: 0 }) // returns '0x...?' const packed = BigInt(packedHex) // Slot 5 (bytes 128–159) const tokenIdHex = toHex(tokenIdBytes, { pad: 0 }) const tokenId = BigInt(tokenIdHex)Locations to update:
- web/src/utils/extradataToTokenInfo.ts – line with
Buffer.from(packedBytes).toString("hex")- web/src/utils/extradataToTokenInfo.ts – line with
Buffer.from(tokenIdBytes).toString("hex")web/src/pages/Resolver/Parameters/Court.tsx (2)
96-107: LGTM! Clean dispute kit options mapping with gated support.The logic properly maps supported dispute kits to options with gated flags, using the DisputeKits enum for consistent identification of gated dispute kit types.
109-116: LGTM! Smart default selection logic.The automatic selection of the single available dispute kit improves user experience while maintaining flexibility for multiple options.
…bgraph chore: dispute-kit-gated-subgraph-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
subgraph/core/src/utils.ts(1 hunks)subgraph/core/subgraph.template.yaml(1 hunks)subgraph/core/subgraph.yaml(1 hunks)web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx(4 hunks)web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx(3 hunks)web/src/pages/Cases/CaseDetails/Appeal/Shutter/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Appeal/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx(4 hunks)web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx(4 hunks)web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx(5 hunks)web/src/pages/Cases/CaseDetails/Voting/Shutter/Reveal.tsx(1 hunks)web/src/pages/Cases/CaseDetails/Voting/Shutter/index.tsx(2 hunks)web/src/pages/Cases/CaseDetails/Voting/index.tsx(4 hunks)web/src/utils/shutter.ts(3 hunks)
🧠 Learnings (13)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Cases/CaseDetails/Appeal/Shutter/index.tsx (6)
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx (7)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx (6)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx (8)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx (12)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
web/src/pages/Cases/CaseDetails/Voting/Shutter/index.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
subgraph/core/subgraph.yaml (3)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
subgraph/core/subgraph.template.yaml (3)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
subgraph/core/src/utils.ts (6)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx (11)
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (14)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:5-16
Timestamp: 2024-10-24T08:18:13.218Z
Learning: In the getClient function in kleros-sdk/src/requests/gqlClient.ts, the consumer is responsible for validating the endpoint, and the Client handles invalid endpoints by throwing appropriate errors.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:13-17
Timestamp: 2024-10-22T10:07:21.327Z
Learning: In the SDK, getPublicClient() handles the scenario where publicClient is undefined by throwing SdkNotConfiguredError, so additional error handling in functions that call getPublicClient() is not necessary.
web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx (11)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
🧬 Code Graph Analysis (3)
web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx (1)
web/src/utils/shutter.ts (1)
encrypt(151-175)
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx (1)
web/src/hooks/useClassicAppealContext.tsx (1)
useSelectedOptionContext(119-119)
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (1)
web/src/utils/wrapWithToast.ts (1)
catchShortMessage(49-51)
✅ Files skipped from review due to trivial changes (2)
- web/src/utils/shutter.ts
- web/src/pages/Cases/CaseDetails/Voting/Shutter/Reveal.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- web/src/pages/Cases/CaseDetails/Voting/index.tsx
- web/src/pages/Cases/CaseDetails/Appeal/index.tsx
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Cases/CaseDetails/Appeal/Shutter/index.tsx (6)
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx (7)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx (6)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx (8)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx (12)
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
web/src/pages/Cases/CaseDetails/Voting/Shutter/index.tsx (12)
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:125-127
Timestamp: 2024-10-29T10:14:52.512Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when isEmailUpdateable is false, user?.emailUpdateableAt is always defined. Therefore, using the non-null assertion ! with user?.emailUpdateableAt! is acceptable because TypeScript may not infer its definiteness.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1764
File: web/src/components/ScrollTop.tsx:12-28
Timestamp: 2024-12-03T13:58:53.597Z
Learning: In the React component ScrollTop (web/src/components/ScrollTop.tsx), the effect hook is intentionally designed to execute only once, so dependencies are not added to the dependency array.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
subgraph/core/subgraph.yaml (3)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
subgraph/core/subgraph.template.yaml (3)
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/dataMappings/utils/actionTypes.ts:29-29
Timestamp: 2024-10-22T09:36:10.478Z
Learning: In kleros-sdk/src/dataMappings/utils/actionTypes.ts, the abi field in AbiEventMapping is intentionally typed as string because it is parsed later in the action functions.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
subgraph/core/src/utils.ts (6)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx (11)
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (14)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: Harman-singh-waraich
PR: #1759
File: web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx:140-143
Timestamp: 2024-11-26T10:50:23.399Z
Learning: In the Kleros-v2 React project, errors are handled by the wrapWithToast function, which displays error messages to users via toast notifications.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:5-16
Timestamp: 2024-10-24T08:18:13.218Z
Learning: In the getClient function in kleros-sdk/src/requests/gqlClient.ts, the consumer is responsible for validating the endpoint, and the Client handles invalid endpoints by throwing appropriate errors.
Learnt from: Harman-singh-waraich
PR: #1755
File: kleros-app/src/lib/atlas/providers/AtlasProvider.tsx:130-144
Timestamp: 2024-11-21T05:47:08.973Z
Learning: In kleros-app/src/lib/atlas/providers/AtlasProvider.tsx, it is acceptable to pass queryClient as a positional parameter to the useQuery hook.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:13-17
Timestamp: 2024-10-22T10:07:21.327Z
Learning: In the SDK, getPublicClient() handles the scenario where publicClient is undefined by throwing SdkNotConfiguredError, so additional error handling in functions that call getPublicClient() is not necessary.
web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx (11)
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx:64-0
Timestamp: 2025-05-09T13:39:15.086Z
Learning: In PersonFields.tsx, the useEffect hook for address validation intentionally uses an empty dependency array to run only once on component mount. This is specifically designed for the dispute duplication flow when aliasesArray is already populated with addresses that need initial validation.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:0-0
Timestamp: 2025-05-15T06:50:45.650Z
Learning: In the Kleros V2 codebase, it's acceptable to use ESLint disable comments for dependency arrays in useEffect hooks when including certain dependencies (like state that is being updated within the effect) would cause infinite loops.
Learnt from: Harman-singh-waraich
PR: #1729
File: web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx:69-69
Timestamp: 2024-10-29T10:13:04.524Z
Learning: In web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, when the button is disabled, the associated logic won't be reached, and certain code paths may exist for TypeScript purposes.
🧬 Code Graph Analysis (3)
web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx (1)
web/src/utils/shutter.ts (1)
encrypt(151-175)
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx (1)
web/src/hooks/useClassicAppealContext.tsx (1)
useSelectedOptionContext(119-119)
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (1)
web/src/utils/wrapWithToast.ts (1)
catchShortMessage(49-51)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Analyze (javascript)
- GitHub Check: contracts-testing
- GitHub Check: Mend Security Check
🔇 Additional comments (26)
web/src/pages/Cases/CaseDetails/Voting/Classic/index.tsx (2)
18-21: LGTM! Clean addition of gated dispute kit support.The
isGatedprop is properly added to the interface and component signature, maintaining type safety and consistency with the broader gated dispute kit implementation.
31-34: Consistent prop propagation to child components.The
isGatedflag is correctly passed down to bothCommitandRevealcomponents, enabling them to conditionally handle gated dispute kit logic.web/src/pages/Cases/CaseDetails/Appeal/Classic/index.tsx (2)
20-23: LGTM! Proper interface extension for gated dispute kits.The
isGatedprop is correctly added to the interface and component signature, maintaining consistency with the gated dispute kit implementation pattern.
51-51: Clean prop propagation using object spread syntax.The
isGatedprop is properly passed to the Fund component using object spread syntax, which is a clean approach for passing additional props.subgraph/core/src/utils.ts (1)
7-7: DisputeKitID extraction offset verified as correctThe disputeKitID is always encoded as the third uint256 in extraData (bytes 64–96) for both Classic and Gated dispute kits—additional gating data is appended after byte 96. This fixed‐position slicing matches the ABI encoding in prepareArbitratorExtradata.ts and does not break existing functionality.
Key locations:
- subgraph/core/src/utils.ts – extractDisputeKitIDFromExtraData uses
extraData.subarray(64, 96)- web/src/utils/prepareArbitratorExtradata.ts – ABI encodes
[subcourtID, noOfVotes, disputeKit]into the first three 32-byte slots- web/src/utils/extradataToTokenInfo.ts – gating fields begin at slot 4 (bytes 96–128), so disputeKitID extraction remains unaffected
web/src/pages/Cases/CaseDetails/Appeal/Shutter/index.tsx (2)
19-22: LGTM! Consistent gated dispute kit support addition.The
isGatedprop is properly added following the same pattern as other components, maintaining consistency across the appeal component family.
50-50: Proper prop propagation to Fund component.The
isGatedprop is correctly passed to the Fund component using object spread syntax, enabling gated dispute kit funding logic.web/src/pages/Cases/CaseDetails/Voting/Shutter/index.tsx (2)
19-22: LGTM! Proper interface extension for Shutter voting.The
isGatedprop is correctly added to the interface and component signature, maintaining consistency with the voting component family.
30-30: Appropriate prop propagation to ShutterCommit.The
isGatedprop is passed to the ShutterCommit component during the commit period, which is the appropriate place for gated dispute kit logic in the Shutter voting flow.web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx (3)
9-9: LGTM: Import for gated dispute kit support added correctly.The addition of
simulateDisputeKitGatedCastCommitimport enables support for gated dispute kits alongside the existing classic functionality.
28-28: LGTM: Props interface and component signature updated correctly.The
isGatedboolean prop is properly typed in the interface and correctly destructured in the component signature to support conditional dispute kit selection.Also applies to: 31-31
63-67: LGTM: Conditional dispute kit selection implemented correctly.The conditional logic properly selects between gated and classic simulation functions based on the
isGatedflag, and the dependency is correctly added to the useCallback array to ensure proper re-evaluation when the gating status changes.Also applies to: 87-87
web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx (2)
9-12: LGTM: Gated dispute kit support added correctly.The component properly supports both gated and classic Shutter dispute kits through conditional simulation function selection. The interface, imports, and component signature are all correctly updated.
Also applies to: 36-36, 60-68
109-117: LGTM: Conditional simulation function selection implemented correctly.The logic properly switches between gated and classic Shutter simulation functions based on the
isGatedflag, and the dependency is correctly included in the useCallback array.Also applies to: 140-140
subgraph/core/subgraph.yaml (2)
164-201: LGTM: DisputeKitGated data source configured correctly.The data source configuration follows the established pattern with appropriate contract address, start block, event handlers, and ABI references. The reuse of existing event handlers and entities is appropriate since gated dispute kits share the same event structure as classic ones.
202-239: LGTM: DisputeKitGatedShutter data source configured correctly.The configuration is consistent with other dispute kit data sources and properly includes all necessary ABIs, event handlers, and entities for indexing gated Shutter dispute kit events.
subgraph/core/subgraph.template.yaml (2)
163-200: LGTM: DisputeKitGated template data source added correctly.The template follows the established pattern with appropriate placeholders for network-specific deployment values. The configuration is consistent with existing dispute kit data sources.
201-238: LGTM: DisputeKitGatedShutter template data source added correctly.The template configuration is properly structured and will generate correct subgraph manifests for gated Shutter dispute kits across different network deployments.
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (3)
13-13: LGTM: Interface and imports updated correctly for gated dispute kit support.The component properly supports gated dispute kits with the addition of the simulation function import, optional
arbitrableprop, and requiredisGatedboolean prop. The component signature is correctly updated.Also applies to: 45-45, 50-50, 53-53
75-75: LGTM: Defensive programming for potentially undefined answers.The nullish coalescing operator ensures
getSaltAndChoicereceives an empty array instead of undefined, preventing potential runtime errors when dispute details are not yet available.
79-84: LGTM: Conditional simulation function selection implemented correctly.The logic properly selects between gated and classic vote reveal simulation functions based on the
isGatedflag. The dependency is correctly added to the useCallback array to ensure proper re-evaluation.Also applies to: 105-105
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx (2)
68-101: Well-structured conditional logic for gated dispute kit support.The implementation correctly:
- Adds mutually exclusive enabling conditions for classic vs gated simulations
- Uses consistent argument structure for both simulation hooks
- Returns the appropriate simulation data and write function based on the
isGatedflagHowever, verify that line 91 should use
useWriteDisputeKitShutterFundAppealfor the gated flow rather than a gated-specific write hook.
103-127: Clean integration of gated flag into component interface.The interface and component correctly:
- Add the
isGatedboolean prop to the interface- Update the component signature to receive the prop
- Pass the
isGatedparameter to theuseFundAppealhookweb/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx (3)
11-16: Complete import structure for gated dispute kit support.The imports correctly include both classic and gated simulation/write hooks, providing proper separation of functionality for each dispute kit type.
70-107: Excellent implementation of dual dispute kit support.The
useFundAppealhook correctly implements support for both classic and gated dispute kits with:
- Proper separation of simulation and write hooks for each type
- Mutually exclusive enabling conditions
- Consistent argument structure and return interface
- Dedicated gated write hook usage (unlike the Shutter version)
109-141: Consistent interface integration for gated support.The interface and component changes properly integrate the
isGatedflag with correct typing and parameter passing to the hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (1)
59-59: Good performance optimization with memoization.The memoized
drawIterationscalculation prevents unnecessary recalculations and includes a sensible upper bound. Consider adding a comment to explain the magic numbers (4 for the multiplier and 100 for the maximum).+ // Calculate draw iterations: numberOfVotes * 4, capped at 100 for performance const drawIterations = useMemo(() => Math.min(100, Number(numberOfVotes ?? 0) * 4), [numberOfVotes]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx(2 hunks)
🧠 Learnings (2)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (9)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:233-233
Timestamp: 2024-10-09T10:19:11.816Z
Learning: In 'web-devtools/src/app/(main)/ruler/RulingModes.tsx', the label 'Random Preset' is correct and should not be changed to 'Automatic Random'.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (9)
Learnt from: Harman-singh-waraich
PR: #1794
File: web/src/hooks/useStarredCases.tsx:13-18
Timestamp: 2024-12-16T17:17:32.359Z
Learning: In useStarredCases.tsx, when handling the starredCases Map from local storage, direct mutation is acceptable to prevent the overhead of copying, provided it doesn't adversely affect React's render cycle.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/RulingModes.tsx:233-233
Timestamp: 2024-10-09T10:19:11.816Z
Learning: In 'web-devtools/src/app/(main)/ruler/RulingModes.tsx', the label 'Random Preset' is correct and should not be changed to 'Automatic Random'.
Learnt from: Harman-singh-waraich
PR: #1775
File: web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx:0-0
Timestamp: 2024-12-09T12:36:59.441Z
Learning: In the StakeWithdrawButton component, the transaction flow logic is tightly linked to component updates, so extracting it into a custom hook does not provide significant benefits.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:98-103
Timestamp: 2024-10-09T10:23:39.325Z
Learning: In SelectArbitrable.tsx of the web-devtools project (React/TypeScript), direct DOM manipulation using child.click() is acceptable when considered reasonably safe.
Learnt from: nikhilverma360
PR: #1632
File: web/src/components/DisputeView/DisputeInfo/DisputeInfoList.tsx:37-42
Timestamp: 2024-06-27T10:11:54.861Z
Learning: useMemo is used in DisputeInfoList to optimize the rendering of FieldItems based on changes in fieldItems, ensuring that the mapping and truncation operation are only performed when necessary.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: contracts-testing
🔇 Additional comments (1)
web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx (1)
76-76: I’ve confirmed in DrawButton.tsx that for “university” cases you pass the user‐entereddrawJurornonce (an address‐encoded BigInt) and for all other dispute kits you computedrawIterationsasmin(100, votes × 4)to ensure the simulated draw covers all potential jurors. Since every kit’sdraw(_disputeID, _nonce)signature accepts a flat iteration count, this change remains compatible with both classic and shutter (and future) dispute kits without additional per‐kit branching. No code changes are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx(3 hunks)web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx(5 hunks)web/src/pages/Resolver/Parameters/Jurors.tsx(2 hunks)
🧠 Learnings (2)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Resolver/Parameters/Jurors.tsx (13)
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1687
File: web/src/context/AtlasProvider.tsx:225-244
Timestamp: 2024-10-15T16:18:32.543Z
Learning: In web/src/context/AtlasProvider.tsx, the atlasUri variable comes from environment variables and does not change, so it does not need to be included in dependency arrays.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
🧬 Code Graph Analysis (1)
web/src/pages/Resolver/Parameters/Jurors.tsx (1)
web/src/utils/prepareArbitratorExtradata.ts (1)
prepareArbitratorExtradata(48-68)
🚧 Files skipped from review as they are similar to previous changes (2)
- web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx
- web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: kleros-sdk/src/utils/getDispute.ts:38-40 Timestamp: 2024-10-21T10:32:16.970Z Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'. Learnt from: tractorss PR: kleros/kleros-v2#1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Learnt from: Harman-singh-waraich PR: kleros/kleros-v2#1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. web/src/pages/Resolver/Parameters/Jurors.tsx (13)
Learnt from: Harman-singh-waraich
PR: #1739
File: web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx:22-26
Timestamp: 2024-11-07T10:48:16.774Z
Learning: In the Coherency component (web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx), totalResolvedVotes is always greater than or equal to totalCoherentVotes. When both are zero, 0/0 results in NaN, which is acceptable in this context.
Learnt from: Harman-singh-waraich
PR: #1716
File: web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx:29-42
Timestamp: 2024-10-28T05:55:12.728Z
Learning: In the CustomContextInputs component located at web-devtools/src/app/(main)/dispute-template/CustomContextInputs.tsx, the DisputeRequestParams array is used to exclude certain variables from the custom input since they are already provided in a preceding component. Therefore, converting it to a type is unnecessary.
Learnt from: kemuru
PR: #1774
File: web/src/components/CasesDisplay/index.tsx:61-61
Timestamp: 2024-12-06T13:04:50.495Z
Learning: In web/src/components/CasesDisplay/index.tsx, the variables numberDisputes and numberClosedDisputes can sometimes be NaN, and should default to 0 using logical OR (||) to prevent display issues in the StatsAndFilters component.
Learnt from: Harman-singh-waraich
PR: #1703
File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61
Timestamp: 2024-10-14T13:58:25.708Z
Learning: In web/src/hooks/queries/usePopulatedDisputeData.ts, the query and subsequent logic only execute when disputeData.dispute?.arbitrableChainId and disputeData.dispute?.externalDisputeId are defined, so initialContext properties based on these values are safe to use without additional null checks.
Learnt from: Harman-singh-waraich
PR: #1687
File: web/src/context/AtlasProvider.tsx:225-244
Timestamp: 2024-10-15T16:18:32.543Z
Learning: In web/src/context/AtlasProvider.tsx, the atlasUri variable comes from environment variables and does not change, so it does not need to be included in dependency arrays.
Learnt from: jaybuidl
PR: #1582
File: web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx:88-90
Timestamp: 2024-10-09T10:22:41.474Z
Learning: Next.js recommends using the useEffect hook to set isClient and using suppressHydrationWarning as a workaround for handling hydration inconsistencies, especially when dealing with data like knownArbitrables that may differ between server-side and client-side rendering. This approach is acceptable in TypeScript/React applications, such as in web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx.
Learnt from: Harman-singh-waraich
PR: #1744
File: web/src/hooks/useGenesisBlock.ts:9-31
Timestamp: 2024-11-19T05:31:48.701Z
Learning: In useGenesisBlock.ts, within the useEffect hook, the conditions (isKlerosUniversity, isKlerosNeo, isTestnetDeployment) are mutually exclusive, so multiple imports won't execute simultaneously, and race conditions are not a concern.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In kleros-sdk/src/sdk.ts, the PublicClient type is used and should not be flagged as unused.
Learnt from: tractorss
PR: #1982
File: web/src/pages/Resolver/Landing/index.tsx:62-62
Timestamp: 2025-05-15T06:50:40.859Z
Learning: In the Landing component, it's safe to pass dispute?.dispute?.arbitrated.id as 0x${string} to usePopulatedDisputeData without additional null checks because the hook internally handles undefined parameters through its isEnabled flag and won't execute the query unless all required data is available.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as kleros-sdk/src/requests/gqlClient.ts) exports only a single entity, it's acceptable to use default exports instead of named exports.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-10-08T16:23:56.290Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: jaybuidl
PR: #1647
File: web/src/context/NewDisputeContext.tsx:0-0
Timestamp: 2024-07-25T11:58:27.058Z
Learning: The delete operator is used in the constructDisputeTemplate function in web/src/context/NewDisputeContext.tsx to remove the policyURI field if it is an empty string.
Learnt from: Harman-singh-waraich
PR: #1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.
🧬 Code Graph Analysis (1)
web/src/pages/Resolver/Parameters/Jurors.tsx (1)
web/src/utils/prepareArbitratorExtradata.ts (1)
prepareArbitratorExtradata(48-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Analyze (javascript)
- GitHub Check: contracts-testing
🔇 Additional comments (1)
web/src/pages/Resolver/Parameters/Jurors.tsx (1)
9-9: LGTM: Import reorderingThe import statement reordering improves code organization without affecting functionality.
Also applies to: 17-17
| refetchInterval: REFETCH_INTERVAL, | ||
| }, | ||
| args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? "")], | ||
| args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? "0")], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix type mismatch: Use numeric 0 instead of string "0"
The prepareArbitratorExtradata function expects noOfVotes as a number, but the fallback value "0" is a string. This could cause type errors or unexpected behavior in the ABI encoding.
- args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? "0")], + args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? 0)],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? "0")], | |
| args: [prepareArbitratorExtradata(disputeData.courtId ?? "", disputeData.numberOfJurors ?? 0)], |
🤖 Prompt for AI Agents
In web/src/pages/Resolver/Parameters/Jurors.tsx at line 61, the fallback value for numberOfJurors is incorrectly provided as a string "0" instead of a numeric 0. Change the fallback from the string "0" to the number 0 to match the expected number type for the prepareArbitratorExtradata function and avoid type mismatch issues. |



This is a follow-up on #2045.
Changes
extraDataencodingPR-Codex overview
This PR introduces support for gated dispute kits, enhancing the dispute management system with new functionalities and adjustments across various components.
Detailed summary
addressfield todisputeKitinuseDisputeDetailsQuery.disputeKitDisputewithextraDatainuseRoundDetailsQuery.SubmitDisputeButtonandSubmitBatchDisputesButtonto handledisputeKitData.extractDisputeKitIDFromExtraDatafunction to adjust byte extraction.IDisputeKitData,IGatedDisputeData, andISomeFutureDisputeDatatypes inNewDisputeContext.isGatedprop and functionality for gated dispute kits.extraDataToTokenInfoutility to decode token information.DisputeKitGatedandDisputeKitGatedShutter.prepareArbitratorExtradatato handle optional dispute kit data.Summary by CodeRabbit
Summary by CodeRabbit
New Features
Improvements
User Experience
Bug Fixes