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

migrate to react-router v6 #384

Merged
merged 4 commits into from
Mar 29, 2022

Conversation

internetti
Copy link
Member

the documentation feature of storybook requires an upgrade to version 6.
this version updated their dependency to react router to v6, which had a lot of breaking changes.
stack overflow thread about that

this pull request migrates the pwa and the authnz frontend to the new react router version

@rational-terraforming-golem
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: internetti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@neb42 neb42 left a comment

Choose a reason for hiding this comment

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

In the authnz frontend the redirect after login is broken. If I manually go to /app after login it works.

Comment on lines 2 to 4
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import 'bootstrap/dist/js/bootstrap.bundle.min';
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed here

Copy link
Member Author

Choose a reason for hiding this comment

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

copy paste issue

<Link to="/clients/add" className="btn btn-sm btn-success">
<Link to="add" className="btn btn-sm btn-success">
Copy link
Member

Choose a reason for hiding this comment

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

Why has this changed but /clients/${c.id} hasn't?

Copy link
Member Author

Choose a reason for hiding this comment

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

forgot

Copy link
Member

Choose a reason for hiding this comment

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

As in /clients/${c.id} should be ${c.id}?

Copy link
Member Author

Choose a reason for hiding this comment

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

either way, they should be consistent, yes

<NavLink className="nav-link" activeClassName="active" to="/organizations">
<NavLink className="nav-link" to="/organizations">
Copy link
Member

Choose a reason for hiding this comment

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

Are we losing some functionality here? I can't actually see NavLink in the v6 docs

Copy link
Member

Choose a reason for hiding this comment

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

Found it.

<NavLink
            to="tasks"
            className={({ isActive }) =>
              isActive ? activeClassName : undefined
            }
          >

Copy link
Member Author

Choose a reason for hiding this comment

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

according to the docs, an active class will be applied by default when active, and since this is the class we've been using, I didn't see the need to add it ourselves.

Comment on lines 44 to 48
<Link className="btn btn-darkula btn-sm" to="organizations/add">
<Link className="btn btn-darkula btn-sm" to="add">
Copy link
Member

Choose a reason for hiding this comment

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

Same point here. Has something changed with the link behaviour? If it's a choice between add and /oragnizations/add the later is clearer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought just adding add to the current url was a more elegant solution, and actually more clear to me, but I won't insist on this.

Copy link
Member

Choose a reason for hiding this comment

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

I'm in two minds about it. The full url is more readable, if I just look at "add" I don't really know what page I'm linking too. But if I were to change the url path I have less places to update it in if I just use "add".

Personally I'd go with the full url, but I don't have strong feelings when it comes to the pwa and authnz

@@ -28,6 +28,7 @@ const AuthWrapper: React.FC<AuthWrapperProps> = ({
onTokenChange,
injectToken = 'access_token',
}) => {
console.log('ATUH WRAPPER', scopes, clientId);
Copy link
Member

Choose a reason for hiding this comment

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

Remove

@internetti internetti force-pushed the storybookDocsLibUpdate branch from 3df7b1e to b0e9160 Compare March 11, 2022 14:26
@rational-terraforming-golem
Copy link
Contributor

@internetti: Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@internetti internetti force-pushed the storybookDocsLibUpdate branch from b0e9160 to 64b67b7 Compare March 14, 2022 11:18
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

"@storybook/addon-ondevice-knobs": "~5.3.25",
"@storybook/react-native": "~5.3.25",
"@storybook/react-native-server": "~5.3.23",
"@react-native-async-storage/async-storage": "^1.16.1",
Copy link
Member

Choose a reason for hiding this comment

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

Why this package? Is it a peer dep?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, of @storybook/react-native

@neb42
Copy link
Member

neb42 commented Mar 29, 2022

/lgtm

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