Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
fix createWithServerProps()
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Aug 5, 2023
1 parent 6ae2ccc commit fa22ac9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log (@egomobile/next-utils)

## 0.9.2
## 0.9.3

- **BREAKING CHANGE**: improve use of execution contextes of `EnhanceApiContext`

Expand Down
24 changes: 22 additions & 2 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egomobile/next-utils",
"version": "0.9.2",
"version": "0.9.3",
"description": "Handy utils and extensions for Next.js",
"main": "lib/index.js",
"engines": {
Expand Down Expand Up @@ -52,11 +52,13 @@
"@egomobile/node-utils": "^0.3.0",
"@egomobile/nodelike-utils": "^0.2.2",
"@types/node": "18.11.9",
"deepmerge": "4.3.1",
"joi": "17.9.2"
},
"devDependencies": {
"@egomobile/http-server": "^0.63.1",
"@egomobile/tsconfig": "^5.0.0",
"@types/deepmerge": "2.2.0",
"del-cli": "5.0.0",
"eslint": "8.46.0",
"eslint-config-ego": "^0.17.1",
Expand All @@ -73,4 +75,4 @@
"@egomobile/http-server": ">=0.63.1",
"next": ">=13.0.0"
}
}
}
10 changes: 6 additions & 4 deletions src/middlewares/withServerProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import deepmerge from "deepmerge";
import { asAsync, toStringSafe } from "@egomobile/node-utils";
import type { GetServerSideProps, GetServerSidePropsContext, GetServerSidePropsResult } from "next";
import type { Nilable, Nullable } from "../types/internal";
import type { IServerErrorHandlerContext, ServerErrorHandler, ServerMiddleware } from "../types";
import { wrapServerHandler } from "../utils/internal/wrapServerHandler";
import { deepMerge } from "../utils/internal/deepMerge";
import { cloneObj } from "../utils/internal/cloneObj";


Expand Down Expand Up @@ -169,9 +169,11 @@ export function createWithServerProps<TContext = IWithServerPropsActionContext>(

const resultProps = await action(enhanceExecCtx.context as unknown as TContext);

return deepMerge(
cloneObj(enhanceExecCtx.result),
cloneObj(resultProps)
return cloneObj(
deepmerge(
cloneObj(enhanceExecCtx.result),
cloneObj(resultProps)
)
);
}
catch (ex: any) {
Expand Down
32 changes: 0 additions & 32 deletions src/utils/internal/deepMerge.ts

This file was deleted.

0 comments on commit fa22ac9

Please sign in to comment.