@blocklet/discuss-kit 1.5.55 → 1.5.56
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/lib/cjs/comments.js +2 -12
- package/lib/es/comments.js +1 -11
- package/package.json +5 -5
package/lib/cjs/comments.js
CHANGED
|
@@ -3,6 +3,7 @@ const react = require("react");
|
|
|
3
3
|
const Theme = require("@arcblock/ux/lib/Theme");
|
|
4
4
|
const joinUrl = require("url-join");
|
|
5
5
|
const PropTypes = require("prop-types");
|
|
6
|
+
const reactUse = require("react-use");
|
|
6
7
|
const SessionManager = require("@arcblock/did-connect/lib/SessionManager");
|
|
7
8
|
const Session = require("@arcblock/did-connect/lib/Session");
|
|
8
9
|
const Button = require("@arcblock/ux/lib/Button");
|
|
@@ -12,7 +13,6 @@ const ButtonGroup = require("@mui/material/ButtonGroup");
|
|
|
12
13
|
const context = require("@arcblock/ux/lib/Locale/context");
|
|
13
14
|
const reactErrorBoundary = require("react-error-boundary");
|
|
14
15
|
const discussKitUx = require("@blocklet/discuss-kit-ux");
|
|
15
|
-
const ahooks = require("ahooks");
|
|
16
16
|
const ErrorFallback = require("./components/error-fallback");
|
|
17
17
|
const locales = require("./locales");
|
|
18
18
|
const getWsClient = require("./ws");
|
|
@@ -29,16 +29,6 @@ const ButtonGroup__default = /* @__PURE__ */ _interopDefaultLegacy(ButtonGroup);
|
|
|
29
29
|
const ErrorFallback__default = /* @__PURE__ */ _interopDefaultLegacy(ErrorFallback);
|
|
30
30
|
const getWsClient__default = /* @__PURE__ */ _interopDefaultLegacy(getWsClient);
|
|
31
31
|
const api__default = /* @__PURE__ */ _interopDefaultLegacy(api);
|
|
32
|
-
const useAsyncRetry = (fn, deps = []) => {
|
|
33
|
-
const state = ahooks.useRequest(fn, {
|
|
34
|
-
refreshDeps: deps
|
|
35
|
-
});
|
|
36
|
-
return {
|
|
37
|
-
...state,
|
|
38
|
-
value: state == null ? void 0 : state.data,
|
|
39
|
-
retry: state == null ? void 0 : state.run
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
32
|
const getPrefix = () => {
|
|
43
33
|
var _a, _b;
|
|
44
34
|
const service = (_b = (_a = window.blocklet) == null ? void 0 : _a.componentMountPoints) == null ? void 0 : _b.find((x) => x.name === "did-comments");
|
|
@@ -166,7 +156,7 @@ function DiscussKitComments({
|
|
|
166
156
|
const {
|
|
167
157
|
t
|
|
168
158
|
} = context.useLocaleContext();
|
|
169
|
-
const objectRatingState = useAsyncRetry(() => api.fetchRatingStats(object.id));
|
|
159
|
+
const objectRatingState = reactUse.useAsyncRetry(() => api.fetchRatingStats(object.id));
|
|
170
160
|
const handlers = {
|
|
171
161
|
ADD_COMMENT: (data) => {
|
|
172
162
|
add(formatComment(data));
|
package/lib/es/comments.js
CHANGED
|
@@ -2,6 +2,7 @@ import { useMemo, useEffect, useContext } from "react";
|
|
|
2
2
|
import { styled } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import joinUrl from "url-join";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import { useAsyncRetry } from "react-use";
|
|
5
6
|
import SessionManager from "@arcblock/did-connect/lib/SessionManager";
|
|
6
7
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
7
8
|
import Button from "@arcblock/ux/lib/Button";
|
|
@@ -11,22 +12,11 @@ import ButtonGroup from "@mui/material/ButtonGroup";
|
|
|
11
12
|
import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
|
|
12
13
|
import { ErrorBoundary } from "react-error-boundary";
|
|
13
14
|
import { InternalThemeProvider, DefaultEditorConfigProvider, CommentsProvider, useCommentsContext, BinaryThumb, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
|
|
14
|
-
import { useRequest } from "ahooks";
|
|
15
15
|
import ErrorFallback from "./components/error-fallback";
|
|
16
16
|
import { translations } from "./locales";
|
|
17
17
|
import getWsClient, { useSubscription } from "./ws";
|
|
18
18
|
import api, { fetchRatingStats } from "./api";
|
|
19
19
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
20
|
-
const useAsyncRetry = (fn, deps = []) => {
|
|
21
|
-
const state = useRequest(fn, {
|
|
22
|
-
refreshDeps: deps
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
...state,
|
|
26
|
-
value: state == null ? void 0 : state.data,
|
|
27
|
-
retry: state == null ? void 0 : state.run
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
20
|
const getPrefix = () => {
|
|
31
21
|
var _a, _b;
|
|
32
22
|
const service = (_b = (_a = window.blocklet) == null ? void 0 : _a.componentMountPoints) == null ? void 0 : _b.find((x) => x.name === "did-comments");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.56",
|
|
4
4
|
"description": "A react component for Discuss Kit blocklet.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/es/index.js",
|
|
@@ -37,15 +37,14 @@
|
|
|
37
37
|
"@arcblock/did-connect": "^2.7.8",
|
|
38
38
|
"@arcblock/ux": "^2.7.8",
|
|
39
39
|
"@arcblock/ws": "^1.18.89",
|
|
40
|
-
"@blocklet/discuss-kit-ux": "1.5.
|
|
41
|
-
"@blocklet/editor": "1.5.
|
|
40
|
+
"@blocklet/discuss-kit-ux": "1.5.56",
|
|
41
|
+
"@blocklet/editor": "1.5.56",
|
|
42
42
|
"@emotion/react": "^11.10.5",
|
|
43
43
|
"@emotion/styled": "^11.10.5",
|
|
44
44
|
"@mui/icons-material": "^5.14.3",
|
|
45
45
|
"@mui/lab": "^5.0.0-alpha.139",
|
|
46
46
|
"@mui/material": "^5.14.4",
|
|
47
47
|
"@uiw/react-md-editor": "^3.19.7",
|
|
48
|
-
"ahooks": "^3.7.8",
|
|
49
48
|
"axios": "^0.27.2",
|
|
50
49
|
"clsx": "^1.2.1",
|
|
51
50
|
"flat": "^5.0.2",
|
|
@@ -53,6 +52,7 @@
|
|
|
53
52
|
"lodash": "^4.17.21",
|
|
54
53
|
"prop-types": "^15.8.1",
|
|
55
54
|
"react-error-boundary": "^3.1.4",
|
|
55
|
+
"react-use": "^17.4.0",
|
|
56
56
|
"rehype-sanitize": "^5.0.1",
|
|
57
57
|
"timeago.js": "^4.0.2",
|
|
58
58
|
"uppload": "^3.2.1",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"vite-plugin-build": "^0.7.1",
|
|
78
78
|
"vite-plugin-svgr": "^2.2.2"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "f0421c3bc64908662a3473dca07931971aca5228"
|
|
81
81
|
}
|