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

fix: Improve state management #353

Merged
merged 3 commits into from
Jun 4, 2024
Merged

fix: Improve state management #353

merged 3 commits into from
Jun 4, 2024

Conversation

dan437
Copy link
Collaborator

@dan437 dan437 commented Jun 4, 2024

Description

We fixed this issue, eliminating an edge case related to network switching where we were unnecessarily polling for transaction status.

This PR improves state management to ensure unique smart transactions, and includes code to fix this issue for a small subset of users who have encountered this issue. The code to fix the issue for this subset of users will be removed in a future version once we have confirmed this is resolved.

@dan437 dan437 requested a review from a team as a code owner June 4, 2024 15:19
@dan437 dan437 changed the title Improve state management fix: Improve state management Jun 4, 2024
@@ -460,6 +460,66 @@ describe('SmartTransactionsController', () => {
} as NetworkState);
expect(checkPollSpy).toHaveBeenCalled();
});

it('calls "ensureUniqueSmartTransactions" on network change if it is a new chainId', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that we check that this method is called, but we don't test what this method does. Do we want to add tests for that method in particular? Or, if the method isn't intended to be called on its own, should it be made private and then we test the behavior of the method in this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, you're right. Thanks for pointing that out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the method need to be public then, at least? Do we anticipate consumers needing to call it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's only a private function and will be removed in one of the upcoming releases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've marked the function as private in the code to make it clearer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you forget to push? :)

dbrans
dbrans previously approved these changes Jun 4, 2024
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Great, LGTM!

@dan437 dan437 merged commit 57dc578 into main Jun 4, 2024
16 checks passed
@dan437 dan437 deleted the ensure-unique-stx branch June 4, 2024 16:31
@cryptodev-2s cryptodev-2s mentioned this pull request Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants