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.
Changes
List Changes Introduced by this PR
package.json
andpackage-lock.json
after updating all dependencies to their latest version.AppRouter
to wrap our Route components within a single Routes component. This was necessary after updatingreact-router-dom
.Login
to use a navigation hook to redirect the user to the 'view-orders' page after logging in. This was also necessary after updatingreact-router-dom
.Purpose
Describe the problem or feature in addition to a link to the issues.
Approach
How does this change address the problem?
The changes in this update include all of our packages being updated to their latest version, and all breaking changes fixed. Vulnerabilities have also been reduced to 1 remaining, which requires manual review (running
npm audit fix
does not fix this vulnerability, as it is a dependency of ourreact-scripts
package, which is already fully up-to-date).Pre-Testing TODOs
What needs to be done before testing
npm install
for all dependencies to be updated based on the versions listed inpackage.json
.Testing Steps
How do the users test this change?
npm outdated
to confirm that all packages are up-to-date. Of course, this will change as time passes and new versions are released after today (up-to-date as of June 26, 2022).npm audit
to confirm that the vulnerabilities have been reduced to 1 remaining (the one that requires manual review, as mentioned above). Much like the previous step, this will change as time passes and new vulnerabilities are found.Login
andAppRouter
.Learning
Describe the research stage
Below are the detailed steps that I took throughout the full update process.
npm outdated
to get a list of packages, our current versions, and the latest versions available. This helps gauge how significant the changes may be with updating (are any of the updates going to a new major version?)npm audit
to gauge how many vulnerabilities are found.react-router-dom
.react-router-dom
, and the update was from v5.2.0. After finding a post describing this change (linked below), I wrapped all Route components inAppRouter
within a single Routes component and changed thecomponent
property for each Route toelement
.Login
component, I knew we needed to updateLogin
to be a functional component and use hooks for navigating.useHistory()
hook, but then notice that has been replaced by theuseNavigate()
hook.useNavigate()
, I updateLogin
to be a functional component and use theuseNavigate()
hook to direct the user to '/view-orders' after logging in.npm outdated
no longer shows any packages that need to be updated.npm audit
has now reduced the vulnerability count significantly. Results now show 5 moderate, 11 high. 15 of those vulnerabilities are tied tolodash
, and 1 is tied tonth-check
.npm audit fix
which is able to fix those 15lodash
vulnerabilities.nth-check
, which requires manual review.nth-check
is listed as a dependency ofreact-scripts
after runningnpm audit
again.Links to blog posts, patterns, libraries or addons used to solve this problem
react-router-dom
v6component
toelement
useHistory()
hookuseHistory()
hook is actually replaced now, and that I should use theuseNavigate()
hook insteaduseNavigate()
hookCloses Shift3#7