Repository navigation
Fix component load bugs #1265
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
Fix component load bugs #1265
Changes from all commits
5e37eb6
727fc20
0f8b36e
5a0cdde
0f3c032
7e28fec
ae85158
79a5556
5485663
021563e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -147,11 +147,12 @@ describe('Ledgers Page container', () => { | |||||
| expect(wrapper.find('.txn').length).toBe(0) | ||||||
|
|
||||||
| server.send(prevLedgerMessage) | ||||||
| await sleep(260) | ||||||
| wrapper.update() | ||||||
| expect(wrapper.exists()).toBe(true) | ||||||
| expect(wrapper.find('.ledgers').length).toBe(1) | ||||||
| expect(wrapper.find('.ledger-list').length).toBe(1) | ||||||
| expect(wrapper.find('.ledger').length).toBe(1) | ||||||
| expect(wrapper.find('.ledger').length).toBe(2) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the two .ledger react components in the wrapper? Since we send one
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the same reason 2 components were expected here -
One is the latest validated ledger and another from
|
||||||
|
|
||||||
| server.send(validationMessage) | ||||||
| // validation-messages are processed in batches every 200 ms | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -36,42 +36,30 @@ export const ValidatorsData = () => { | |||
| const [feeSettings, setFeeSettings] = useState<FeeSettings>() | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amongst the diff'ed lines in this file, what is the fix for this bug:
I'm trying to understand the goal of the changes in this file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Goal is to return the data from VHS even if data from clio is yet not available. It used to do that previous to #1232. You can test it by running it locally on a previous commit. The difference in livenet tab and localhost tab in the video will make it more clear. |
||||
|
|
||||
| const merged = useMemo(() => { | ||||
| const fromVHS = validatorsFromVHS ?? {} | ||||
| const fromStream = validatorsFromValidations ?? {} | ||||
|
|
||||
| if ( | ||||
| !validatorsFromVHS || | ||||
| !( | ||||
| validatorsFromValidations && | ||||
| Object.keys(validatorsFromValidations).length | ||||
| ) | ||||
| Object.keys(fromVHS).length === 0 && | ||||
| Object.keys(fromStream).length === 0 | ||||
| ) { | ||||
| return [] | ||||
| } | ||||
|
|
||||
| const updated: Record<string, StreamValidator> = {} | ||||
| const keys = new Set( | ||||
| Object.keys(validatorsFromVHS).concat( | ||||
| Object.keys(validatorsFromValidations), | ||||
| ), | ||||
| ) | ||||
| const keys = new Set(Object.keys(fromVHS).concat(Object.keys(fromStream))) | ||||
| keys.forEach((d: string) => { | ||||
| const newData: StreamValidator = | ||||
| validatorsFromVHS[d] || validatorsFromValidations[d] | ||||
| const newData: StreamValidator = fromVHS[d] ?? fromStream[d] | ||||
| if ( | ||||
| newData.ledger_index == null && | ||||
| validatorsFromValidations[d] && | ||||
| validatorsFromValidations[d].ledger_index | ||||
| fromStream[d] && | ||||
| fromStream[d].ledger_index | ||||
| ) { | ||||
| // VHS uses `current_index` instead of `ledger_index` | ||||
| // If `ledger_index` isn't defined, then we're still using the VHS data, | ||||
| // instead of the Streams data | ||||
| newData.ledger_index = validatorsFromValidations[d].ledger_index | ||||
| } | ||||
| if (newData.current_index == null) { | ||||
| newData.signing_key = validatorsFromValidations[d].signing_key | ||||
| } | ||||
|
Comment on lines
-68
to
-70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can we remove this part? it seems like the properties that are being set have changed with this logic change now
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If explorer/src/containers/Validators/index.tsx Line 207 in 8d317d9
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
| // latest hash and time comes from the validations stream | ||||
| if (validatorsFromValidations[d]) { | ||||
| newData.time = validatorsFromValidations[d].time | ||||
| newData.ledger_hash = validatorsFromValidations[d].ledger_hash | ||||
| newData.ledger_index = fromStream[d].ledger_index | ||||
| newData.ledger_hash = fromStream[d].ledger_hash | ||||
| } | ||||
|
|
||||
| updated[d] = newData | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.