Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
totraev committed Nov 30, 2024
1 parent e4bcb0c commit 067e55e
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/app/state/DelegationV2State.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ export function DelegationV2State({ children }: PropsWithChildren) {
[],
);

// // Effects
// useEffect(
// function syncDelegations() {
// if (!data?.delegations) {
// return;
// }
// // TODO: Find the difference and update only the difference
// if (!areDelegationsEqual(delegations, data.delegations)) {
// setDelegations(data.delegations);
// }
// },
// [data?.delegations, delegations, setDelegations],
// );

// Methods
const addDelegation = useCallback(
(newDelegation: DelegationV2) => {
Expand All @@ -76,8 +62,6 @@ export function DelegationV2State({ children }: PropsWithChildren) {
[delegations],
);

console.log(delegations, data?.delegations);

// Context
const state = useMemo(
() => ({
Expand All @@ -102,18 +86,3 @@ export function DelegationV2State({ children }: PropsWithChildren) {
}

export const useDelegationV2State = useState;

function areDelegationsEqual(
arr1: DelegationV2[],
arr2: DelegationV2[],
): boolean {
if (arr1.length !== arr2.length) return false;

return arr1.every((item, index) => {
const other = arr2[index];
return (
item.stakingTxHashHex === other.stakingTxHashHex &&
item.state === other.state
);
});
}

0 comments on commit 067e55e

Please sign in to comment.