From: SleeplessOne1917 Date: Sat, 24 Jun 2023 04:06:19 +0000 (-0400) Subject: Fix comments expanding when they're not supposed to (#1540) X-Git-Url: http://these/git/%22https:/join-lemmy.org/static/%7BimageUploadUrl%7D?a=commitdiff_plain;h=e8dda77d4b76bb2d0d3746a391815018e52c11fc;p=lemmy-ui.git Fix comments expanding when they're not supposed to (#1540) --- diff --git a/package.json b/package.json index f01c907..01f5100 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,8 @@ "isomorphic-cookie": "^1.2.4", "jwt-decode": "^3.1.2", "lemmy-js-client": "0.18.0-rc.2", - "lodash": "^4.17.21", + "lodash.isequal": "^4.5.0", + "lodash.merge": "^4.6.2", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", "markdown-it-emoji": "^2.0.2", @@ -98,6 +99,7 @@ "@types/bootstrap": "^5.2.6", "@types/express": "^4.17.17", "@types/html-to-text": "^9.0.0", + "@types/lodash.isequal": "^4.5.6", "@types/markdown-it": "^12.2.3", "@types/markdown-it-container": "^2.0.5", "@types/node": "^20.1.2", diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index b4d3d66..41f67e6 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -49,6 +49,7 @@ import { SaveComment, TransferCommunity, } from "lemmy-js-client"; +import deepEqual from "lodash.isequal"; import { commentTreeMaxDepth } from "../../config"; import { BanType, @@ -198,7 +199,7 @@ export class CommentNode extends Component { componentWillReceiveProps( nextProps: Readonly<{ children?: InfernoNode } & CommentNodeProps> ): void { - if (this.props != nextProps) { + if (!deepEqual(this.props, nextProps)) { this.setState({ showReply: false, showEdit: false, diff --git a/webpack.config.js b/webpack.config.js index f14707a..dcb88c5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const nodeExternals = require("webpack-node-externals"); const CopyPlugin = require("copy-webpack-plugin"); const RunNodeWebpackPlugin = require("run-node-webpack-plugin"); -const merge = require("lodash/merge"); +const merge = require("lodash.merge"); const { ServiceWorkerPlugin } = require("service-worker-webpack"); const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; diff --git a/yarn.lock b/yarn.lock index 76d9355..46fcba1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1595,6 +1595,18 @@ resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== +"@types/lodash.isequal@^4.5.6": + version "4.5.6" + resolved "https://registry.yarnpkg.com/@types/lodash.isequal/-/lodash.isequal-4.5.6.tgz#ff42a1b8e20caa59a97e446a77dc57db923bc02b" + integrity sha512-Ww4UGSe3DmtvLLJm2F16hDwEQSv7U0Rr8SujLUA2wHI2D2dm8kPu6Et+/y303LfjTIwSBKXB/YTUcAKpem/XEg== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*": + version "4.14.195" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.195.tgz#bafc975b252eb6cea78882ce8a7b6bf22a6de632" + integrity sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg== + "@types/markdown-it-container@^2.0.5": version "2.0.5" resolved "https://registry.yarnpkg.com/@types/markdown-it-container/-/markdown-it-container-2.0.5.tgz#abd793b64c5adc7b2d1e8963eddb388198248152" @@ -5916,6 +5928,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" @@ -5951,7 +5968,7 @@ lodash@^3.10.1: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== -lodash@^4.17.20, lodash@^4.17.21: +lodash@^4.17.20: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==