forked from friedger/stacks-send-many
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update data sources and state #130
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This starts implementing jotai for state management in place of a few different inherited patterns. This fixes the connect and auth interactions, login state, and fetching data like account balances on the profile. KNOWN ISSUE: login not persisting on refresh
The old structure had a page per city, then a page per action, and a container for each set of actions in components. This can be streamlined to be page -> actions, with each component getting rewritten from the bottom-up.
This also explores some new patterns for fetching data from the API, including some manual rate limiting and updates to useEffect() patterns with async functions. Once finalized all changes will be applied throughout.
In general, an atom should indicate whether it's loaded or not, then serve the data versus tryign to infer this from the data itself.
Now that the pattern is defined this can be ported over to other objects, but there are too many requests firing off against the API. Lots of 429s.
Very simple and straight-forward approach to throttling all requests through fetchJson() with configurable limits. Set to 4 requests every second, evenly-spaced for now.
This adds a pattern for fetching data from V1 or V2 contracts based on their relative configs, in an iterative manner that should support any number of contract versions.
This is close enough that we should be able to cut a testing release on dev, then push to main and keep iteratively adding new features.
This was surprisingly simple, thank you jotaigit add -A
This was referenced May 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to review and rewrite both the CityCoins UI auth management and user state.
The main goals are to:
implement the CityCoins API for all read-only data callsuse jotai atoms for state management across componentseliminate the "per-city" page by using "selected city" state insteadThis will resolve a few open issues, speed up the load times, and create a more consistent experience that can be built on top of. Definitely still a WIP - collaborators are welcome!
Update: After trying out a few ways to approach data storage and transitions, patterns are emerging! The mining and stacking activity components are a great example of fetching, computing, and storing data. If the block height is updated then data is automatically fetched again.
There are definitely some optimizations to be had here, but it's a great start and will let me focus on the action pages to bring this back to life.
Done
Moved known issues to #129 to track for future PRs.
Fixes #126
Fixes #120
Fixes #117
Fixes #102