Skip to content

Commit

Permalink
Merge pull request #51 from blitz-js/fix-48
Browse files Browse the repository at this point in the history
Handle "props: undefined" gracefully
  • Loading branch information
Skn0tt authored Feb 24, 2021
2 parents c157a85 + edd28a0 commit e7e3fea
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 60 deletions.
19 changes: 18 additions & 1 deletion example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,15 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@babel/types@^7.12.17":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80"
integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==
dependencies:
"@babel/helper-validator-identifier" "^7.12.11"
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@hapi/[email protected]":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.1.tgz#068553e867f0f63225a506ed74e899441af53e10"
Expand Down Expand Up @@ -1584,9 +1593,17 @@ babel-plugin-module-resolver@^4.0.0:
resolve "^1.13.1"

"babel-plugin-superjson-next@file:..":
version "0.2.1"
version "0.2.2"
dependencies:
"@babel/helper-module-imports" "^7.12.13"
"@babel/types" "^7.12.17"
hoist-non-react-statics "^3.3.2"

"babel-plugin-superjson-next@file:../":
version "0.2.2"
dependencies:
"@babel/helper-module-imports" "^7.12.13"
"@babel/types" "^7.12.17"
hoist-non-react-statics "^3.3.2"

[email protected]:
Expand Down
4 changes: 4 additions & 0 deletions src/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export function withSuperJSONProps<P>(
return result;
}

if (!result.props) {
return result;
}

const { json, meta } = SuperJSON.serialize(result.props);
const props = json as any;

Expand Down
62 changes: 3 additions & 59 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -829,16 +829,6 @@
source-map "^0.6.1"
write-file-atomic "^3.0.0"

"@jest/types@^25.5.0":
version "25.5.0"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.5.0.tgz#4d6a4793f7b9599fc3680877b856a97dbccf2a9d"
integrity sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@jest/types@^26.6.2":
version "26.6.2"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e"
Expand Down Expand Up @@ -990,14 +980,6 @@
dependencies:
"@types/istanbul-lib-coverage" "*"

"@types/istanbul-reports@^1.1.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2"
integrity sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==
dependencies:
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"

"@types/istanbul-reports@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821"
Expand Down Expand Up @@ -1712,14 +1694,6 @@ [email protected]:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

chalk@^4.0.0, chalk@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
Expand Down Expand Up @@ -2219,11 +2193,6 @@ didyoumean@^1.2.1:
resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.1.tgz"
integrity sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=

diff-sequences@^25.2.6:
version "25.2.6"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd"
integrity sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==

diff-sequences@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz"
Expand Down Expand Up @@ -3491,17 +3460,7 @@ jest-config@^26.6.3:
micromatch "^4.0.2"
pretty-format "^26.6.2"

jest-diff@^25.2.1:
version "25.5.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.5.0.tgz#1dd26ed64f96667c068cef026b677dfa01afcfa9"
integrity sha512-z1kygetuPiREYdNIumRpAHY6RXiGmp70YHptjdaxTWGmA085W3iCnXNx0DhflK3vwrKmrRWyY1wUpkPMVxMK7A==
dependencies:
chalk "^3.0.0"
diff-sequences "^25.2.6"
jest-get-type "^25.2.6"
pretty-format "^25.5.0"

jest-diff@^26.6.2:
jest-diff@^26.0.0, jest-diff@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz"
integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==
Expand Down Expand Up @@ -3554,11 +3513,6 @@ jest-environment-node@^26.6.2:
jest-mock "^26.6.2"
jest-util "^26.6.2"

jest-get-type@^25.2.6:
version "25.2.6"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877"
integrity sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==

jest-get-type@^26.3.0:
version "26.3.0"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz"
Expand Down Expand Up @@ -4804,17 +4758,7 @@ prettier@^2.2.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==

pretty-format@^25.2.1, pretty-format@^25.5.0:
version "25.5.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a"
integrity sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==
dependencies:
"@jest/types" "^25.5.0"
ansi-regex "^5.0.0"
ansi-styles "^4.0.0"
react-is "^16.12.0"

pretty-format@^26.0.1, pretty-format@^26.6.2:
pretty-format@^26.0.0, pretty-format@^26.0.1, pretty-format@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz"
integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==
Expand Down Expand Up @@ -4946,7 +4890,7 @@ rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

[email protected], react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1:
[email protected], react-is@^16.7.0, react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
Expand Down

0 comments on commit e7e3fea

Please sign in to comment.