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

Refactor/energy system (serialize-instruction-data-frontend.md) #359

Merged

Conversation

EmekaManuel
Copy link
Contributor

Problem

  • The code for fetching and managing player data had inconsistent use of .then() for handling promises.
  • Error handling was not robust, leading to potential issues if data fetching or decoding fails.
  • Account change subscription lacked proper cleanup, which could cause memory leaks.

Summary of Changes

  • Refactored code to use async/await for consistency and readability.
  • Added try/catch blocks for improved error handling when fetching and decoding player data.
  • Created a separate async function for fetching player data to enhance code organization.
  • Implemented error handling in the account change callback to handle decoding errors.
  • Added cleanup logic for the account change subscription to prevent memory leaks.

Onyewuchi Emeka added 2 commits August 27, 2024 06:06
- Replaced .then() with async/await for fetching player data.
- Added try/catch blocks for error handling when fetching and decoding player data.
- Created a separate async function for fetching player data to improve readability.
- Implemented error handling in the account change callback to handle decoding errors.
- Added cleanup logic for the account change subscription to prevent memory leaks.
@mikemaccana
Copy link
Collaborator

mikemaccana commented Aug 27, 2024

Thanks for these improvements @EmekaManuel ! I note you already have a PR for this content, see #348 - can you move these changes into that?

@mikemaccana mikemaccana changed the title Refactor/energy system Refactor/energy system (serialize-instruction-data-frontend.md) Aug 27, 2024
@EmekaManuel
Copy link
Contributor Author

Thanks for these improvements @EmekaManuel ! I note you already have a PR for this content, see #348 - can you move these changes into that?

Done ✅

…e links and deprecated methods. also removed unused imports
@mikemaccana mikemaccana merged commit 609d5d1 into solana-foundation:main Sep 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants