Skip to content
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

Contract Explorer: Contract storage filters #1233

Merged
merged 12 commits into from
Feb 3, 2025

Conversation

quietbits
Copy link
Contributor

@quietbits quietbits commented Jan 29, 2025

  1. The filter logic is "or", meaning that selecting more filters includes more records. We could implement "and" logic (narrowing down selection), making the filters dynamic. Adding more data to store locally might slow the UI, though.
  2. We need an "Apply" button to apply the selected filters. Because we can have thousands of records, we can't make updates on the fly as the filters are selected. For now, I added a basic button, so we have "Apply" and "Clear filter" buttons.
  3. What should be the logic for selecting value filters? I'm using object keys from decoded value XDR, and we might end up with numbers. For example, CAS3FL6TLZKDGGSISDBWGGPXT3NRR4DYTZD7YOD3HMYO6LTJUVGRVEAM (Mainnet). key filters are much more predictable than value, which can be pretty much anything.
  4. How should we handle very long lists of filters? For example, CDVQVKOY2YSXS2IC7KN6MNASSHPAO7UN2UR2ON4OI2SKMFJNVAMDX6DP (Mainnet) has a very long list of value filters.
  5. We need to keep checking how we handle thousands of records. On my machine, CDVQVKOY2YSXS2IC7KN6MNASSHPAO7UN2UR2ON4OI2SKMFJNVAMDX6DP (Mainnet) with 6k+ records at this time, seems OK. It takes a few seconds on the initial load, and then the loader is displayed when sorting. But the UI doesn't feel sluggish; it just takes longer to load the result.
  6. Should we display the filtered results count?
  7. I will add tests in a follow-up PR once we're all set with the UI.

image

@quietbits quietbits linked an issue Jan 29, 2025 that may be closed by this pull request
@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@quietbits quietbits requested a review from jeesunikim January 29, 2025 16:32
@janewang
Copy link
Contributor

Should we display the filtered results count?
No, I think there is no need. Once they filter down the list, maybe the user can download

@jeesunikim
Copy link
Contributor

I'm getting a warning for missing key prop in console.
console

@stellar-jenkins
Copy link

1 similar comment
@stellar-jenkins
Copy link

Copy link
Contributor

@jeesunikim jeesunikim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some questions but looks great. low key worried about big contract data entries getting larger and larger 😅

@stellar-jenkins
Copy link

@sdfcharles
Copy link

sdfcharles commented Feb 3, 2025

@quietbits great work! some thoughts:

1. The filter logic is "or", meaning that selecting more filters includes more records. We could implement "and" logic (narrowing down selection), making the filters dynamic. Adding more data to store locally might slow the UI, though.

CleanShot 2025-02-03 at 11 34 54
Yeah I think we should implement the 'and' logic here as well. In this case, the user has selected two filters but the combination of the two filters doesn't match any records. There should be copy here that "No results. Clear filters and try again."

2. We need an "Apply" button to apply the selected filters. Because we can have thousands of records, we can't make updates on the fly as the filters are selected. For now, I added a basic button, so we have "Apply" and "Clear filter" buttons.

Could we have the Clear Filter and Apply buttons be fixed at the bottom of the menu and the filters be scrollable? This will be clearer to the user to apply their filters instead of scrolling all the way to the bottom of a potentially long list to apply filters.

3. What should be the logic for selecting value filters? I'm using object keys from decoded value XDR, and we might end up with numbers. For example, CAS3FL6TLZKDGGSISDBWGGPXT3NRR4DYTZD7YOD3HMYO6LTJUVGRVEAM (Mainnet). key filters are much more predictable than value, which can be pretty much anything.

CleanShot 2025-02-03 at 11 29 20
When we show numbers in the values filter, some suggestions:

  1. if its a G address or C address, truncate the string in the pill e.g. CD25...G5JY
  2. wrap the pills when they go past the width of the container
  3. handle any other number with a truncated pill e.g. 12345678...

4. How should we handle very long lists of filters? For example, CDVQVKOY2YSXS2IC7KN6MNASSHPAO7UN2UR2ON4OI2SKMFJNVAMDX6DP (Mainnet) has a very long list of value filters.

Can we set a max-height of 320px on the filter menus and make them scrollable?

5. We need to keep checking how we handle thousands of records. On my machine, CDVQVKOY2YSXS2IC7KN6MNASSHPAO7UN2UR2ON4OI2SKMFJNVAMDX6DP (Mainnet) with 6k+ records at this time, seems OK. It takes a few seconds on the initial load, and then the loader is displayed when sorting. But the UI doesn't feel sluggish; it just takes longer to load the result.

CleanShot 2025-02-03 at 11 26 52
Agreed the UI loading state feels good here. Wondering if it's more of a browsabliity issue – one suggestion would be to make the page number box editable so users can access middle pages easier, in addition to clicking through one page as a time.

6. Should we display the filtered results count?

CleanShot 2025-02-03 at 11 38 22
Yeah, let's add that here.

@stellar-jenkins
Copy link

@jeesunikim
Copy link
Contributor

Screenshot 2025-02-03 at 12 38 05 PM
stellar.expert link for contract address leads to https://stellar.expert/explorer/public/account/ instead of https://stellar.expert/explorer/public/contract/. Example, the contract account CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA is linked to public/account which is incorrect

@stellar-jenkins
Copy link

@quietbits quietbits merged commit d9a936d into main Feb 3, 2025
5 checks passed
@quietbits quietbits deleted the sc-contract-storage-filters branch February 3, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Contract Details > Contract Storage > Add filters
5 participants