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

fix: Clear console errors #244

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@material-ui/styles": "4.11.4",
"classnames": "2.3.1",
"cozy-bar": "7.16.0",
"cozy-client": "^24.9.1",
"cozy-client": "^27.6.5",
"cozy-device-helper": "1.12.0",
"cozy-doctypes": "1.82.2",
"cozy-editor-core": "134.0.3",
Expand Down
11 changes: 10 additions & 1 deletion src/components/notes/EditorCorner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import { useI18n } from 'cozy-ui/transpiled/react/I18n'

import SharingWidget from 'components/notes/sharing'

// https://mui.com/components/tooltips/#custom-child-element
const ForwardedIcon = React.forwardRef(function ForwardedIcon(props, ref) {
return (
<div ref={ref}>
<Icon {...props} />
</div>
)
})

const EditorCorner = ({ doc, isPublic, isReadOnly, title }) => {
const { t } = useI18n()
if (!isPublic) return <SharingWidget file={doc.file} title={title} />
else if (isReadOnly) {
return (
<Tooltip title={t('Notes.Editor.read_only')}>
<Icon icon="lock" color="var(--primaryTextColor)" />
<ForwardedIcon icon="lock" color="var(--primaryTextColor)" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not updating cozy-ui in order to forwardRef by default on Icon? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't remember why I didn't choose to update cozy-ui, maybe there were more problems. I can do that though

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you created the issue on cozy-ui? Can you link it in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't create an issue yet, the build is failing with the latest cozy-ui for a different reason (konnector related)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, I'm not sure the forwardRef error exists with the latest cozy-ui (that doesn't work on cozy-notes right now, I prefered delivering the fixes instead)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sur the issue still exist in the latest UI's version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check on the latest version after cozy-notes is delivered

Copy link
Contributor Author

Choose a reason for hiding this comment

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

</Tooltip>
)
} else return null
Expand Down
3 changes: 1 addition & 2 deletions src/components/notes/EditorCorner.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ describe('EditorCorner', () => {
<WithStyles(ForwardRef(Tooltip))
title="This note is in read-only mode."
>
<Icon
<ForwardRef(ForwardedIcon)
color="var(--primaryTextColor)"
icon="lock"
spin={false}
/>
</WithStyles(ForwardRef(Tooltip))>
`)
Expand Down
2 changes: 1 addition & 1 deletion src/components/notes/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ Editor.propTypes = {
noteId: PropTypes.string.isRequired,
readOnly: PropTypes.bool.isRequired,
userName: PropTypes.string,
returnUrl: PropTypes.string
returnUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired
}
2 changes: 1 addition & 1 deletion src/targets/browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const initApp = () => {

const shareCode = getPublicSharecode()
const token = shareCode || data.token
const isPublic = shareCode || !token || token == ''
const isPublic = Boolean(shareCode || !token || token == '')

// initialize the client to interact with the cozy stack
const client = new CozyClient({
Expand Down
106 changes: 95 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4333,6 +4333,18 @@ array.prototype.flatmap@^1.2.4:
es-abstract "^1.18.0-next.1"
function-bind "^1.1.1"

array.prototype.foreach@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array.prototype.foreach/-/array.prototype.foreach-1.0.2.tgz#592b177c8d6abb84e14de1649eb6e7cc5eb9c9ae"
integrity sha512-gCOgyBKIaFL5hekfQLhsNmF0TY4Y5JdtOyFKtbSpL72oiCAZ9Zi7TFvcfSsM1LnBFMog1RYVJF0PHgtnY+U5nA==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.19.0"
es-array-method-boxes-properly "^1.0.0"
get-intrinsic "^1.1.1"
is-string "^1.0.7"

asap@~2.0.3:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
Expand Down Expand Up @@ -5830,10 +5842,10 @@ [email protected]:
sift "^6.0.0"
url-search-params-polyfill "^7.0.0"

cozy-client@^24.9.1:
version "24.10.0"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-24.10.0.tgz#78eaafc8ea9150488f7c4d1db6585fa2a94d3e14"
integrity sha512-hNr4hZD8NAKRQsNoUgHO0fJz1kF8sD42k0l9u0swq4NNBOJYteZfdE+TV1tu1Pzy/u+6KJKlt19PiLNnzD1/tg==
cozy-client@^27.6.5:
version "27.6.5"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-27.6.5.tgz#07ea2be571c030cd05df7841c8fc837ec8f7b3d2"
integrity sha512-FjgHfoNC3EM/d/ov2UEYPxDKkybzCWrJuM+VvP8QSpBsQILVVZUymUZaJNXZTwOB+r6Bd9z9e0X6AZ9u7z545w==
dependencies:
"@cozy/minilog" "1.0.0"
"@types/jest" "^26.0.20"
Expand All @@ -5842,11 +5854,12 @@ cozy-client@^24.9.1:
cozy-device-helper "^1.12.0"
cozy-flags "2.7.1"
cozy-logger "^1.6.0"
cozy-stack-client "^24.10.0"
cozy-stack-client "^27.6.5"
json-stable-stringify "^1.0.1"
lodash "^4.17.13"
microee "^0.0.6"
node-fetch "^2.6.1"
node-polyglot "2.4.2"
open "7.4.2"
prop-types "^15.6.2"
react-redux "^7.2.0"
Expand Down Expand Up @@ -6135,10 +6148,10 @@ cozy-stack-client@^13.8.3:
mime "^2.4.0"
qs "^6.7.0"

cozy-stack-client@^24.10.0:
version "24.10.0"
resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-24.10.0.tgz#892996c4a144bf838e23ce6801ef581e9e7145bd"
integrity sha512-N5BsJAic4YFyctU/GQ+CXxq+fRzMrggBLEqbm3my/N8MccBnWpS4U35ljeOUrZPSEUsiLnZKGUL6RI1i2beuxA==
cozy-stack-client@^27.6.5:
version "27.6.5"
resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-27.6.5.tgz#4b40ad59821b957f161a77132b5346e99be0bc2c"
integrity sha512-aGkchVfvVGfI38qt+R8/BKv8nFN6Ihhx1LFsDYDtV+mW6OxOqVYdd22sIg9iHkusaqJgxgkMYnB9NcnDlC8Ajg==
dependencies:
cozy-flags "2.7.1"
detect-node "^2.0.4"
Expand Down Expand Up @@ -7136,6 +7149,32 @@ es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.18.0, es-abstract@^1.18
string.prototype.trimstart "^1.0.4"
unbox-primitive "^1.0.1"

es-abstract@^1.19.0, es-abstract@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3"
integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==
dependencies:
call-bind "^1.0.2"
es-to-primitive "^1.2.1"
function-bind "^1.1.1"
get-intrinsic "^1.1.1"
get-symbol-description "^1.0.0"
has "^1.0.3"
has-symbols "^1.0.2"
internal-slot "^1.0.3"
is-callable "^1.2.4"
is-negative-zero "^2.0.1"
is-regex "^1.1.4"
is-shared-array-buffer "^1.0.1"
is-string "^1.0.7"
is-weakref "^1.0.1"
object-inspect "^1.11.0"
object-keys "^1.1.1"
object.assign "^4.1.2"
string.prototype.trimend "^1.0.4"
string.prototype.trimstart "^1.0.4"
unbox-primitive "^1.0.1"

es-array-method-boxes-properly@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e"
Expand Down Expand Up @@ -8340,6 +8379,14 @@ get-stream@^5.0.0:
dependencies:
pump "^3.0.0"

get-symbol-description@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6"
integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==
dependencies:
call-bind "^1.0.2"
get-intrinsic "^1.1.1"

get-value@^2.0.3, get-value@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
Expand Down Expand Up @@ -9276,6 +9323,11 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.1.5, is-callable@^1.2.3:
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e"
integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==

is-callable@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945"
integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==

is-ci@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c"
Expand Down Expand Up @@ -9513,14 +9565,19 @@ is-primitive@^2.0.0:
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU=

is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.3:
is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.3, is-regex@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958"
integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==
dependencies:
call-bind "^1.0.2"
has-tostringtag "^1.0.0"

is-shared-array-buffer@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6"
integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==

is-stream@^1.0.1, is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
Expand All @@ -9531,7 +9588,7 @@ is-stream@^2.0.0:
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==

is-string@^1.0.5, is-string@^1.0.6:
is-string@^1.0.5, is-string@^1.0.6, is-string@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd"
integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==
Expand Down Expand Up @@ -9560,6 +9617,13 @@ is-utf8@^0.2.0:
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=

is-weakref@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2"
integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==
dependencies:
call-bind "^1.0.2"

is-whitespace-character@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz#0858edd94a95594c7c9dd0b5c174ec6e45ee4aa7"
Expand Down Expand Up @@ -11444,6 +11508,17 @@ node-notifier@^8.0.0:
uuid "^8.3.0"
which "^2.0.2"

[email protected]:
version "2.4.2"
resolved "https://registry.yarnpkg.com/node-polyglot/-/node-polyglot-2.4.2.tgz#e4876e6710b70dc00b1351a9a68de4af47a5d61d"
integrity sha512-AgTVpQ32BQ5XPI+tFHJ9bCYxWwSLvtmEodX8ooftFhEuyCgBG6ijWulIVb7pH3THigtgvc9uLiPn0IO51KHpkg==
dependencies:
array.prototype.foreach "^1.0.0"
has "^1.0.3"
object.entries "^1.1.4"
string.prototype.trim "^1.2.4"
warning "^4.0.3"

node-polyglot@^2.2.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/node-polyglot/-/node-polyglot-2.4.0.tgz#0d2717ed06640d9ff48a2aebe8d13e39ef03518f"
Expand Down Expand Up @@ -14663,6 +14738,15 @@ string.prototype.trim@^1.1.2, string.prototype.trim@^1.2.1:
define-properties "^1.1.3"
es-abstract "^1.18.0-next.2"

string.prototype.trim@^1.2.4:
version "1.2.5"
resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.5.tgz#a587bcc8bfad8cb9829a577f5de30dd170c1682c"
integrity sha512-Lnh17webJVsD6ECeovpVN17RlAKjmz4rF9S+8Y45CkMc/ufVpTkU3vZIyIC7sllQ1FCvObZnnCdNs/HXTUOTlg==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.19.1"

string.prototype.trimend@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
Expand Down