fix: check needsUpdate flag before showing update available warning#150
Open
ss251 wants to merge 2 commits intosolana-foundation:masterfrom
Open
fix: check needsUpdate flag before showing update available warning#150ss251 wants to merge 2 commits intosolana-foundation:masterfrom
ss251 wants to merge 2 commits intosolana-foundation:masterfrom
Conversation
The code was checking if the updateAvailable object exists rather than checking if updateAvailable.needsUpdate is true. This caused false "update available" warnings even when tools were already at the latest version. Changed all occurrences of `if (updateAvailable)` to `if (updateAvailable?.needsUpdate)` in the following functions: - installAnchorVersionManager - installAnchorUsingAvm - installTrident - installZest - installSolanaVerify
🦋 Changeset detectedLatest commit: cd25c2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or 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
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.
Problem
The install command shows "update available" warnings even when a tool is already at the latest version. This happens because the code checks
if (updateAvailable)(whether the object exists) instead ofif (updateAvailable?.needsUpdate)(whether an update is actually needed).Summary of Changes
Changed all occurrences of
if (updateAvailable)toif (updateAvailable?.needsUpdate)in the following functions:installAnchorVersionManagerinstallAnchorUsingAvminstallTridentinstallZestinstallSolanaVerifyRelated PR
This PR works in conjunction with #147 which fixes version parsing.
The bug scenario (both issues combined):
solana-verify 0.4.11installed0.4.1cargo install-updatecorrectly knows it's0.4.11and reportsneedsUpdate: NoneedsUpdate: Noand shows warning anyway (this PR's fix)Result:
solana-verify 0.4.1 is already installed - v0.4.11 availableTesting this PR alone (user has 0.4.11 installed):
solana-verify 0.4.1 is already installed - v0.4.11 availablesolana-verify 0.4.1 is already installed(no false warning, but version display still wrong due to fix: use greedy regex for version parsing #147)With both PRs merged:
solana-verify 0.4.11 is already installed(correct version + no false warning)Note: If someone actually has
0.4.1installed,cargo install-updatereportsneedsUpdate: Yes, and the warning would correctly appear.Fixes #149