Skip to content

Commit 2e77a41

Browse files
fix(protocol-dashboard): remove '1.0.0' validator-version fallback so fetch actually runs (#14356)
## Summary Follow-up to #14355. The dashboard was still showing `1.0.0` for the Validator current version after that PR shipped. Root cause: the `getCurrentVersion` selector returned `'1.0.0'` as a fallback when `services.validator.currentVersion` was undefined, and `useCurrentVersion` only dispatches `fetchCurrentVersion` when the selected value is `undefined`. The hardcoded fallback short-circuited the dispatch, so the new `getNumberOfVersions` + `getVersion` logic introduced in #14355 never ran. - Remove the `?? '1.0.0'` fallback from the selector so the fetch dispatches. - Harden the `setCurrentVersion` reducer to initialize `state.services.validator` if it doesn't exist yet, since `fetchCurrentVersion` can resolve before `fetchServiceStakeValues` populates it. ## Test plan - [ ] Open the dashboard and confirm `Register a Node` → `Current Version` shows the latest onchain version (currently `1.1.0`) instead of `1.0.0`. - [ ] Hard refresh and confirm no race-condition crashes from `setCurrentVersion` running before service info loads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 380e538 commit 2e77a41

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

packages/protocol-dashboard/src/components/RegisterNodeCard/RegisterNodeCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const RegisterNodeCard = ({ wallet }: { wallet: string }) => {
8484
<Flex alignItems='center' gap='xl'>
8585
<Card p='xl' direction='column'>
8686
<Box>
87-
{storageCommitment == null ? (
87+
{currentVersion == null ? (
8888
<Box mb='xs'>
8989
<Loading />
9090
</Box>

packages/protocol-dashboard/src/store/cache/protocol/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const getCurrentVersion = (
3838
case ServiceType.ContentNode:
3939
return state.cache.protocol.services.contentNode.currentVersion
4040
case ServiceType.Validator:
41-
return state.cache.protocol.services.validator?.currentVersion ?? '1.0.0'
41+
return state.cache.protocol.services.validator?.currentVersion
4242
}
4343
}
4444

packages/protocol-dashboard/src/store/cache/protocol/slice.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,18 @@ const slice = createSlice({
5555
state.delegator.maxDelegators = action.payload.maxDelegators
5656
},
5757
setServiceTypeInfo: (state, action: PayloadAction<SetServiceTypeInfo>) => {
58-
state.services.discoveryProvider = action.payload.discoveryProvider
59-
state.services.contentNode = action.payload.contentNode
60-
state.services.validator = action.payload.validator
58+
state.services.discoveryProvider = {
59+
...action.payload.discoveryProvider,
60+
currentVersion: state.services.discoveryProvider?.currentVersion
61+
}
62+
state.services.contentNode = {
63+
...action.payload.contentNode,
64+
currentVersion: state.services.contentNode?.currentVersion
65+
}
66+
state.services.validator = {
67+
...action.payload.validator,
68+
currentVersion: state.services.validator?.currentVersion
69+
}
6170
},
6271
setEthBlockNumber: (state, action: PayloadAction<number>) => {
6372
state.ethBlockNumber = action.payload
@@ -82,8 +91,14 @@ const slice = createSlice({
8291
action.payload.currentVersion
8392
break
8493
case ServiceType.Validator:
85-
state.services.validator.currentVersion =
86-
action.payload.currentVersion
94+
state.services.validator = {
95+
...(state.services.validator ?? {
96+
isValid: false,
97+
minStake: new BN(0),
98+
maxStake: new BN(0)
99+
}),
100+
currentVersion: action.payload.currentVersion
101+
}
87102
break
88103
}
89104
}

0 commit comments

Comments
 (0)