From b509b9650452935bf1460607b31600cc1ba0bdbe Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:09:11 +0200 Subject: [PATCH] [Glitch] Enforce React Rules of Hooks with eslint Port d9b93bd15e508bd19896950ca5c5d356e7e402d4 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/actions/streaming.js | 2 ++ .../compose/containers/emoji_picker_dropdown_container.js | 1 + .../features/compose/containers/language_dropdown_container.js | 1 + 3 files changed, 4 insertions(+) diff --git a/app/javascript/flavours/glitch/actions/streaming.js b/app/javascript/flavours/glitch/actions/streaming.js index dbf668ccb..b4eb60ad4 100644 --- a/app/javascript/flavours/glitch/actions/streaming.js +++ b/app/javascript/flavours/glitch/actions/streaming.js @@ -52,8 +52,10 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti /** * @param {function(Function, Function): void} fallback */ + const useFallback = fallback => { fallback(dispatch, () => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook pollingId = setTimeout(() => useFallback(fallback), 20000 + randomUpTo(20000)); }); }; diff --git a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js index 66d51947a..d2fe56103 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js @@ -72,6 +72,7 @@ const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({ }, onPickEmoji: emoji => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useEmoji(emoji)); if (onPickEmoji) { diff --git a/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js index 828d08cf5..7f07064c4 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/language_dropdown_container.js @@ -26,6 +26,7 @@ const mapDispatchToProps = dispatch => ({ }, onClose (value) { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useLanguage(value)); },