-
Notifications
You must be signed in to change notification settings - Fork 11
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
frontend: overhaul validator dashboard fetching logic #1166
base: staging
Are you sure you want to change the base?
Conversation
Deploying beaconchain with
|
Latest commit: |
cea818f
|
Status: | ✅ Deploy successful! |
Preview URL: | https://a06908e3.beaconchain.pages.dev |
Branch Preview URL: | https://beds-914-better-dashboard-fe.beaconchain.pages.dev |
3cbdf1c
to
cab1b5d
Compare
190d26c
to
ce80077
Compare
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.
very nice work so far 💪
'validator_dashboard_store', | ||
() => { | ||
const { t: $t } = useTranslation() | ||
// TODO: bring ID in here and remove the provider composable!! |
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.
❤️ love this -> #promotioncantidate
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.
That's where it belongs and we'll add it here when we remove the provider in the near future
45e540d
to
60fe37d
Compare
e932972
to
0fdeb08
Compare
return addUpValues(overview.value?.validators as unknown as Record<string, number>) | ||
}) | ||
|
||
const totalValidators = computed(() => validatorCount.value ?? 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.
maybe validatorCount
should always be 0
-> default from store
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.
I normally initialize values from fetched data as null
to make clear that the data is not yet in the store and avoid hidden bugs.
4f66a32
to
f5ac9ed
Compare
return [] | ||
} | ||
return orderBy( | ||
overview.value.groups.filter(g => !!g.count), | ||
dashboardGroups.value.filter(g => !!g.count), | ||
[ g => g.name.toLowerCase() ], |
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.
why is this even necessary?
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.
It doesn't hurt to keep an alphabetical order, since this will make it easier to find groups if there are too many.
const groupNameLabel = (groupId?: number) => { | ||
return getGroupLabel($t, groupId, groups.value, 'Σ') | ||
} | ||
|
||
const onSort = (sort: DataTableSortEvent) => { | ||
loadData(setQuerySort(sort, lastQuery.value)) | ||
emitUpdate(setQuerySort(sort, props.query)) |
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.
plz don't stop half way...find a better name for setQuerySort....
as I do not understand what happens here
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.
done
frontend/components/dashboard/table/DashboardTableClDeposits.vue
Outdated
Show resolved
Hide resolved
(e: 'update', timeframe: SummaryTimeFrame, query: TableQueryParams): void, | ||
}>() | ||
const emitUpdate = (query: TableQueryParams) => { | ||
emit('update', props.timeFrame, query) |
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.
why is timeframe
not part of the query
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.
currently the summary table is the only component which uses timeframe, in future more components will use it. would suggest doing this when adding it to the other components so that this PR doesn't get more bloated
:options="timeFrames" | ||
option-value="id" | ||
option-label="name" | ||
class="small" | ||
:placeholder="$t('dashboard.group.selection.placeholder')" | ||
@select="($event) => { emit('update', $event, props.query) }" |
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.
you did tightly couple us here to an implementation detail of prime vue
here....🤔
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.
this might already work with @update
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.
The event name wasn't changed in this MR and it belongs to BcDropdown
not to Select
from vue prime
.
Still this line was changed and now looks like this: @select="value => timeFrame = value"
frontend/components/dashboard/table/DashboardTableValueDuty.vue
Outdated
Show resolved
Hide resolved
frontend/components/dashboard/table/DashboardTableWithdrawals.vue
Outdated
Show resolved
Hide resolved
f5ac9ed
to
9fac002
Compare
6ecb02e
to
e1231e7
Compare
f568333
to
0451ac5
Compare
- Overview and SlotViz data is now fetched in `index.vue` and propped down - SlotViz updates are handled through update emits - Introduces proper SSR fetching - removes all direct sibling dependencies on the overview (including the dashboard group composable) - introduces new validator dashboard store - dashboard modyfing actions now emit an `updateAll` event instead of directly calling `refreshOverview` See: BEDS-914
0451ac5
to
314bbed
Compare
- Changes all dashboard table logic to emit update events instead of fetching data themselves - Data is now fetched in the dashboard index component and propped down - Removes all table stores - Introduces dashboard composable to hold fetching logic - Dashboard modifications now trigger only one table request See: BEDS-914
- (BcLoadingSpinner) add background color to backdrop - (DashboardSlotVizDutyVisibilityToggle) prevent hydration mismatch by using `fallback` slot in `ClientOnly` component - Remove previous guest dashboard key from storage when the dashboard is updated
314bbed
to
cea818f
Compare
@marcel-bitfly see |
In the current validator dashboard fetching flow, components will either fetch their own data by reacting to changes in other unrelated components or manually trigger refreshes in unrelated components, making tracing bugs a hassle.
This PR aims to bring back order by making sure that most data fetching happens in the dashboards root component and that these are only triggered through emits. As a consequence of removing sibling component coupling, most of the dashboards Pinia stores won't be necessary anymore.
Edit 06/02/2025:
Branch updated with following adjustments:
resetOverviewData
function tovalidatorDashboardStore
- needed when there's no dashboard key (guest dashboard with no validators), sooverview
isn't refetched and the store needs to reflect empty stateslot-viz
refetch - now data won't update on that table when pollingslot-viz
data, but this is the way it worked before this PR anyway - fixing this is a bigger issue involving changes inBcTable
and all it's implementations.isAllSelected
tohasNoGroupsOrAllSelected
in dashboard root component