-
Notifications
You must be signed in to change notification settings - Fork 56
Conversation
Your Render PR Server URL is https://near-explorer-frontend-with-indexer-pr-770a.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-c620m8cobjd8o3rgsdd0. |
ef7310b
to
fbfad2d
Compare
@frol some tests have failed. That because backend isn't deployable for tests. I've tested it manually and it worked fine |
return await this.call<BlocksListInfo[]>("blocks-list", [ | ||
limit, | ||
paginationIndexer, | ||
]); |
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 want to bring it to your attention that we used to name fields going through WAMP-proto in snake_case and used this explorer-wamp module to actually map the values to the proper types (usually BN
, Date
) and naming convention.
I cannot say I have a very strong opinion about the naming convention (yet, I would vote for snake_case in JSON payloads), but I certainly believe we should convert the data into a proper type in explorer-wamp adapters.
Actually, I believe I did a poor job with call
adapter, which makes a false impression that it will do something with the received data to match the specified type while in fact it just silently casts whatever received value to the specified type, which is naive. call
should always return unknown
type and thus force the user of the adapter to validate the received value and map it over to proper type. Something along these lines: https://github.com/near/near-explorer/blob/master/frontend/src/context/NetworkStatsProvider.tsx#L47-L61 (yet, we already broke the naming convention there, and it also leaked the abstraction from explorer-wamp, by subscribing to the events directly in the Context implementation)
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.
Does I need to move logic from /backend
to /explorer-wamp
and convert to proper types? Or I just need to pass variables in snake_case there?
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 mean in /backend/blocks.js
for example I map through the values and convert values to proper types (mostly to number only) is it correct or I should do it in explorer-wamp/blocks.tsx
file?
Resolves #773
We had a mess with queries as some of them was on backend but huge amount of them on frontend