@blocklet/discuss-kit 1.5.53 → 1.5.55

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.
@@ -3,7 +3,6 @@ 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 useAsyncRetry = require("react-use/lib/useAsyncRetry");
7
6
  const SessionManager = require("@arcblock/did-connect/lib/SessionManager");
8
7
  const Session = require("@arcblock/did-connect/lib/Session");
9
8
  const Button = require("@arcblock/ux/lib/Button");
@@ -13,6 +12,7 @@ const ButtonGroup = require("@mui/material/ButtonGroup");
13
12
  const context = require("@arcblock/ux/lib/Locale/context");
14
13
  const reactErrorBoundary = require("react-error-boundary");
15
14
  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");
@@ -21,7 +21,6 @@ const jsxRuntime = require("react/jsx-runtime");
21
21
  const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
22
22
  const joinUrl__default = /* @__PURE__ */ _interopDefaultLegacy(joinUrl);
23
23
  const PropTypes__default = /* @__PURE__ */ _interopDefaultLegacy(PropTypes);
24
- const useAsyncRetry__default = /* @__PURE__ */ _interopDefaultLegacy(useAsyncRetry);
25
24
  const SessionManager__default = /* @__PURE__ */ _interopDefaultLegacy(SessionManager);
26
25
  const Button__default = /* @__PURE__ */ _interopDefaultLegacy(Button);
27
26
  const Box__default = /* @__PURE__ */ _interopDefaultLegacy(Box);
@@ -30,6 +29,16 @@ const ButtonGroup__default = /* @__PURE__ */ _interopDefaultLegacy(ButtonGroup);
30
29
  const ErrorFallback__default = /* @__PURE__ */ _interopDefaultLegacy(ErrorFallback);
31
30
  const getWsClient__default = /* @__PURE__ */ _interopDefaultLegacy(getWsClient);
32
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
+ };
33
42
  const getPrefix = () => {
34
43
  var _a, _b;
35
44
  const service = (_b = (_a = window.blocklet) == null ? void 0 : _a.componentMountPoints) == null ? void 0 : _b.find((x) => x.name === "did-comments");
@@ -157,7 +166,7 @@ function DiscussKitComments({
157
166
  const {
158
167
  t
159
168
  } = context.useLocaleContext();
160
- const objectRatingState = useAsyncRetry__default.default(() => api.fetchRatingStats(object.id));
169
+ const objectRatingState = useAsyncRetry(() => api.fetchRatingStats(object.id));
161
170
  const handlers = {
162
171
  ADD_COMMENT: (data) => {
163
172
  add(formatComment(data));
@@ -2,7 +2,6 @@ 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/lib/useAsyncRetry";
6
5
  import SessionManager from "@arcblock/did-connect/lib/SessionManager";
7
6
  import { SessionContext } from "@arcblock/did-connect/lib/Session";
8
7
  import Button from "@arcblock/ux/lib/Button";
@@ -12,11 +11,22 @@ import ButtonGroup from "@mui/material/ButtonGroup";
12
11
  import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
13
12
  import { ErrorBoundary } from "react-error-boundary";
14
13
  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
+ };
20
30
  const getPrefix = () => {
21
31
  var _a, _b;
22
32
  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.53",
3
+ "version": "1.5.55",
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,14 +37,15 @@
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.53",
41
- "@blocklet/editor": "1.5.53",
40
+ "@blocklet/discuss-kit-ux": "1.5.55",
41
+ "@blocklet/editor": "1.5.55",
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",
48
49
  "axios": "^0.27.2",
49
50
  "clsx": "^1.2.1",
50
51
  "flat": "^5.0.2",
@@ -52,7 +53,6 @@
52
53
  "lodash": "^4.17.21",
53
54
  "prop-types": "^15.8.1",
54
55
  "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": "f350010bc981e822a2e613962e6d52a187945538"
80
+ "gitHead": "951977b0629324efa638ace24c25e66f9a528ff3"
81
81
  }