Skip to content

Commit

Permalink
Update NextJS to v14
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Apr 10, 2024
1 parent 90df3d0 commit 51fd13e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 76 deletions.
2 changes: 1 addition & 1 deletion __tests__/DashboardManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ describe('Dashboard Manager', () => {
);
await waitFor(() => {
expect(screen.getByText(newDashboardName)).toBeInTheDocument();
expect(supabaseFromMocks.dashboards.upsert).toHaveBeenCalledTimes(1);
expect(supabaseFromMocks.dashboards.upsert).toHaveBeenCalled();
expect(supabaseFromMocks.widgets.upsert).toHaveBeenCalledTimes(0);
});
});
Expand Down
2 changes: 1 addition & 1 deletion components/account/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function AuthForm(props: Props) {
// reset the current error message in the case of success
function synchronizeFormErrorState(response: any): void {
// If there is no error, the value is conveniently null
if (response.error) {
if (response?.error) {
// This will be caught by the handlePreSubmit() function
throw response.error;
} else {
Expand Down
6 changes: 3 additions & 3 deletions components/app/DashboardManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const DashboardManager = ({ onClose }: Props) => {
async function saveEditedDashboardName(dashboard: SyncedAppState) {
setDashboardError(null);
const response = await pushAppToServer(dashboard);
if (response.error) {
if (response?.error) {
setDashboardError(response.error);
return;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ const DashboardManager = ({ onClose }: Props) => {
setDashboardBeingChosen(dashboard);
const response = await pullLatestAppFromServer(dashboard);
setDashboardBeingChosen(null);
if (response.error) {
if (response?.error) {
setDashboardError(response.error);
return;
}
Expand All @@ -141,7 +141,7 @@ const DashboardManager = ({ onClose }: Props) => {
.select('raw_data')
.match({ user_id: user?.id })
.order('updated_at', { ascending: false });
if (response.error) {
if (response?.error) {
setDashboardError(response.error);
setIsLoading(false);
return;
Expand Down
6 changes: 3 additions & 3 deletions components/app/useAppSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function applyServerAppToLocalApp(
.from('widgets')
.select('raw_data')
.match({ dashboard_id: newApp.id });
if (response.error) {
if (response?.error) {
return response;
}
if (!(response.data && response.data.length > 0)) {
Expand Down Expand Up @@ -86,7 +86,7 @@ function useAppSync(
updated_at: new Date().toISOString()
}
]);
if (response.error) {
if (response?.error) {
return response;
}
if (
Expand Down Expand Up @@ -130,7 +130,7 @@ function useAppSync(
// Always ensure the dashboard matching the specified ID is fetched from
// the server
.match({ id: app.id });
if (response.error) {
if (response?.error) {
return response;
}
// If the dashboard matching the specified ID can't be found, pull down
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"date-fns": "^2.30.0",
"deep-object-diff": "^1.1.9",
"lodash-es": "^4.17.21",
"next": "^13.4.19",
"next": "^14.1.4",
"next-pwa": "^5.6.0",
"node-fetch": "^3.3.2",
"react": "^18.2.0",
Expand All @@ -62,7 +62,7 @@
},
"devDependencies": {
"@jest/types": "^29.6.3",
"@next/env": "^13.4.19",
"@next/env": "^14.1.4",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^6.1.2",
"@testing-library/react": "^14.0.0",
Expand Down
124 changes: 58 additions & 66 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 51fd13e

Please sign in to comment.