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

Upgrade Next version in Admin UI and Privacy Center #5111

Merged
merged 9 commits into from
Jul 23, 2024

Conversation

gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Jul 19, 2024

Closes PROD-2077

Description Of Changes

Upgrades our clients to NextJS version 14. We need to upgrade to a later version to be able to use server-side props.

Code Changes

  • Fix instances of NextLink which had breaking changes
  • Update deployment configs now that next export is no longer available. Use output: "export" on the config instead.
  • Upgrade npm packages next and eslint-config-next to latest version (currently 14.2.5)

Steps to Confirm

  • General regression testing
  • Build/deploy success

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Update CHANGELOG.md

Copy link

vercel bot commented Jul 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2024 3:16pm

@@ -1,4 +1,3 @@
NEXT_PUBLIC_FIDESOPS_API=http://0.0.0.0:8080
NEXT_PUBLIC_FIDESCTL_API=/api/v1
NEXT_PUBLIC_FIDESCTL_API_SERVER=http://0.0.0.0:8080
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we never use NEXT_PUBLIC_FIDESCTL_API_SERVER in tests so I removed it.

@@ -8,7 +8,7 @@ describe("Nav Bar", () => {
it("renders all navigation groups with links inside", () => {
cy.visit("/");

cy.get("nav button").should("have.length", 7);
cy.get("[id^='accordion-button']").should("have.length", 4);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After updating uses of NextLinks, some of the elements are an <a> now depending on what they do. So this update is for testing for the actual group headings instead, as the test name suggests.

Comment on lines +46 to +51
// Export the static site for production.
// Rewrites are not supported in static sites.
if (process.env.PROD_EXPORT === "true") {
delete nextConfig.rewrites;
nextConfig.output = "export";
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes are needed because next export has been removed in favor of output: "export".

@@ -203,7 +203,7 @@ export const DefaultHeaderCell = <T,>({
</Text>
);

interface EnableCellProps extends Omit<SwitchProps, "value"> {
interface EnableCellProps extends Omit<SwitchProps, "value" | "onToggle"> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated type definition means these onToggle types are no longer compatible so we needed to omit here in favor of our own definition for this use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice usage of Omit! I'll keep this in mind for later

@@ -1,4 +1,5 @@
{
"private": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eliminates build warnings about missing "license"

Comment on lines -1 to -3
{
"presets": ["next/babel"]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

next no longer uses babel

Comment on lines +20 to +33
},
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.d.ts",
".next/types/**/*.ts"
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes were added automatically after upgrading next and I didn't argue.

Copy link

cypress bot commented Jul 19, 2024

Passing run #9097 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge b043a90 into 62e7013...
Project: fides Commit: 95a51f4505 ℹ️
Status: Passed Duration: 00:36 💡
Started: Jul 23, 2024 3:25 PM Ended: Jul 23, 2024 3:26 PM

Review all test suite changes for PR #5111 ↗︎

@gilluminate gilluminate requested a review from galvana July 22, 2024 15:14
Copy link
Contributor

@galvana galvana left a comment

Choose a reason for hiding this comment

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

Nice work with this migration, I know it wasn't as straightforward as it sounds! I just left a few comments, one for my understanding, and one for a minor label change. Otherwise, this worked as expected, I was able to build it locally and navigate around the app just fine

@@ -50,7 +50,7 @@
"lodash.snakecase": "^4.1.1",
"msw": "^1.2.1",
"narrow-minded": "^1.2.1",
"next": "^12.3.4",
"next": "^14.2.5",
Copy link
Contributor

Choose a reason for hiding this comment

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

🏅

@@ -203,7 +203,7 @@ export const DefaultHeaderCell = <T,>({
</Text>
);

interface EnableCellProps extends Omit<SwitchProps, "value"> {
interface EnableCellProps extends Omit<SwitchProps, "value" | "onToggle"> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice usage of Omit! I'll keep this in mind for later

Comment on lines -147 to +149
ref={preview}
ref={(element) => {
preview(element);
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this change?

Copy link
Contributor Author

@gilluminate gilluminate Jul 22, 2024

Choose a reason for hiding this comment

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

Resolving kind of a weird Type issue here.

React's ref expects to be passed a React.ReactNode object or to be undefined. On the other hand, preview is returning a React.ReactNode object or null. By explicitly creating an arrow function here, ref no longer expects undefined and the Types are compatible, since ref passes the element as React.ReactNode or null.

I'm assuming this popped up because upgrading eslint-config-next is slightly more strict than before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation!

@gilluminate gilluminate force-pushed the gill/PROD-2077_upgrade-next-version-in-all branch from 96e026f to b043a90 Compare July 23, 2024 15:13
@gilluminate gilluminate merged commit bc61a97 into main Jul 23, 2024
13 checks passed
@gilluminate gilluminate deleted the gill/PROD-2077_upgrade-next-version-in-all branch July 23, 2024 15:30
Copy link

cypress bot commented Jul 23, 2024

Passing run #9099 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Upgrade Next version in Admin UI and Privacy Center (#5111)
Project: fides Commit: bc61a97ce9
Status: Passed Duration: 00:36 💡
Started: Jul 23, 2024 3:42 PM Ended: Jul 23, 2024 3:43 PM

Review all test suite changes for PR #5111 ↗︎

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.

2 participants