cozy-sharing 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@11.0.0...cozy-sharing@11.0.1) (2024-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **sharing:** Handle memory leak in self removal ([f9a9384](https://github.com/cozy/cozy-libs/commit/f9a9384fabb8892e35be0a270452ee501bd6b1a6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [11.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@10.4.1...cozy-sharing@11.0.0) (2024-03-11)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["recipient"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
4
10
|
import React from 'react';
|
|
5
11
|
import { useClient } from 'cozy-client';
|
|
6
12
|
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
7
13
|
import { getDisplayName, getInitials } from '../../models';
|
|
14
|
+
import logger from '../../logger';
|
|
8
15
|
|
|
9
16
|
var MemberAvatar = function MemberAvatar(_ref) {
|
|
10
17
|
var recipient = _ref.recipient,
|
|
11
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
19
|
|
|
13
|
-
var client = useClient();
|
|
20
|
+
var client = useClient(); // There are cases when due to apparent memory leaks, the recipient does not exist
|
|
21
|
+
// This will trigger an unhanded error in the Avatar component and crash the app
|
|
22
|
+
// At the moment, we are not sure where is the root cause of this cascading undefined props
|
|
23
|
+
// Nevertheless, we can prevent the crash by returning null if the recipient is undefined
|
|
24
|
+
|
|
25
|
+
if (!recipient) {
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
logger.warn('RecipientAvatar: recipient is missing, see props:', _objectSpread({
|
|
28
|
+
recipient: recipient
|
|
29
|
+
}, rest));
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
14
32
|
/**
|
|
15
33
|
* avatarPath is always the same for a recipient, but image
|
|
16
34
|
* can be different since the stack generate it on the fly.
|
|
@@ -21,6 +39,7 @@ var MemberAvatar = function MemberAvatar(_ref) {
|
|
|
21
39
|
* status changes
|
|
22
40
|
*/
|
|
23
41
|
|
|
42
|
+
|
|
24
43
|
var image = recipient.avatarPath && recipient.status ? "".concat(client.options.uri).concat(recipient.avatarPath, "?v=").concat(recipient.status) : null;
|
|
25
44
|
return /*#__PURE__*/React.createElement(Avatar, _extends({
|
|
26
45
|
image: image,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"sideEffects": [
|
|
72
72
|
"*.css"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "0ac36e39dfef446f11daaa97925814447f7d8201"
|
|
75
75
|
}
|
|
@@ -4,10 +4,21 @@ import { useClient } from 'cozy-client'
|
|
|
4
4
|
import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
5
5
|
|
|
6
6
|
import { getDisplayName, getInitials } from '../../models'
|
|
7
|
+
import logger from '../../logger'
|
|
7
8
|
|
|
8
9
|
const MemberAvatar = ({ recipient, ...rest }) => {
|
|
9
10
|
const client = useClient()
|
|
10
11
|
|
|
12
|
+
// There are cases when due to apparent memory leaks, the recipient does not exist
|
|
13
|
+
// This will trigger an unhanded error in the Avatar component and crash the app
|
|
14
|
+
// At the moment, we are not sure where is the root cause of this cascading undefined props
|
|
15
|
+
// Nevertheless, we can prevent the crash by returning null if the recipient is undefined
|
|
16
|
+
if (!recipient) {
|
|
17
|
+
// eslint-disable-next-line
|
|
18
|
+
logger.warn('RecipientAvatar: recipient is missing, see props:', { recipient, ...rest })
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
/**
|
|
12
23
|
* avatarPath is always the same for a recipient, but image
|
|
13
24
|
* can be different since the stack generate it on the fly.
|