From 481bca54e614d610ecbea79483141f598b147295 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Sun, 31 Dec 2023 13:47:30 +0100 Subject: [PATCH 01/14] the package name is extracted from the patch file name --- .../workflows/reassurePerformanceTests.yml | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 0c4ef2d4ec4d..fffdb32c3b70 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -33,7 +33,15 @@ jobs: # Clear node_modules and reinstall dependencies rm -rf node_modules npm install --force - npx patch-package + + # Check if the patch files exist and apply them + if [ -d "patches" ]; then + for file in patches/*.patch; do + if [ -e "$file" ]; then + npx patch-package `basename $file | sed -e 's/+[0-9]*+.*.patch$//'` + fi + done + fi npx reassure --baseline git switch --force --detach - @@ -42,7 +50,14 @@ jobs: # Repeat clearing node_modules and reinstalling for the feature branch rm -rf node_modules npm install --force - npx patch-package + + if [ -d "patches" ]; then + for file in patches/*.patch; do + if [ -e "$file" ]; then + npx patch-package `basename $file | sed -e 's/+[0-9]*+.*.patch$//'` + fi + done + fi npx reassure --branch @@ -59,4 +74,3 @@ jobs: DURATION_DEVIATION_PERCENTAGE: 20 COUNT_DEVIATION: 0 REGRESSION_OUTPUT: ${{ steps.reassure.outputs.content }} - From a26402d8323ca2552cc958493c578c048cee558b Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 11:06:52 +0100 Subject: [PATCH 02/14] cleaning up reassurePerformanceTests --- .../workflows/reassurePerformanceTests.yml | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index fffdb32c3b70..e2df3fab8c92 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -29,36 +29,13 @@ jobs: BASELINE_BRANCH=${BASELINE_BRANCH:="main"} git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 git switch "$BASELINE_BRANCH" - - # Clear node_modules and reinstall dependencies rm -rf node_modules npm install --force - - # Check if the patch files exist and apply them - if [ -d "patches" ]; then - for file in patches/*.patch; do - if [ -e "$file" ]; then - npx patch-package `basename $file | sed -e 's/+[0-9]*+.*.patch$//'` - fi - done - fi - npx reassure --baseline git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours - - # Repeat clearing node_modules and reinstalling for the feature branch rm -rf node_modules npm install --force - - if [ -d "patches" ]; then - for file in patches/*.patch; do - if [ -e "$file" ]; then - npx patch-package `basename $file | sed -e 's/+[0-9]*+.*.patch$//'` - fi - done - fi - npx reassure --branch - name: Read output.json From 2babd9113b76566afac1347fd0e4b0dac23eaf32 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 11:37:04 +0100 Subject: [PATCH 03/14] cache clean --- .github/workflows/reassurePerformanceTests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index e2df3fab8c92..ff9940b3f8ca 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -30,11 +30,14 @@ jobs: git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 git switch "$BASELINE_BRANCH" rm -rf node_modules + npm cache clean --force npm install --force npx reassure --baseline + git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours rm -rf node_modules + npm cache clean --force npm install --force npx reassure --branch From d6f7c553431807bb3a9d6b29141d913de53af007 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 12:06:46 +0100 Subject: [PATCH 04/14] patch-package --- .github/workflows/reassurePerformanceTests.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index ff9940b3f8ca..96d6d3cb0886 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -29,16 +29,24 @@ jobs: BASELINE_BRANCH=${BASELINE_BRANCH:="main"} git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 git switch "$BASELINE_BRANCH" + + # Clear node_modules and npm cache, then install dependencies and apply patches rm -rf node_modules npm cache clean --force npm install --force + npx patch-package + npx reassure --baseline git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours + + # Repeat the process for the branch tests rm -rf node_modules npm cache clean --force npm install --force + npx patch-package + npx reassure --branch - name: Read output.json From ff502fa4b62b51e16792f0c4f65db1c28392d884 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 12:34:15 +0100 Subject: [PATCH 05/14] move reportScrollManager from ReportActionsView to ReportActionsList to --- .github/workflows/reassurePerformanceTests.yml | 9 --------- src/pages/home/report/ReportActionsList.js | 10 +++++++++- src/pages/home/report/ReportActionsView.js | 8 -------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 96d6d3cb0886..15ebaa2a1df7 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -29,24 +29,15 @@ jobs: BASELINE_BRANCH=${BASELINE_BRANCH:="main"} git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 git switch "$BASELINE_BRANCH" - - # Clear node_modules and npm cache, then install dependencies and apply patches rm -rf node_modules npm cache clean --force npm install --force - npx patch-package - npx reassure --baseline - git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours - - # Repeat the process for the branch tests rm -rf node_modules npm cache clean --force npm install --force - npx patch-package - npx reassure --branch - name: Read output.json diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js index 15170107d768..d7bc95c5baa5 100644 --- a/src/pages/home/report/ReportActionsList.js +++ b/src/pages/home/report/ReportActionsList.js @@ -11,6 +11,7 @@ import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultPro import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; +import useReportScrollManager from '@hooks/useReportScrollManager'; import useThemeStyles from '@hooks/useThemeStyles'; import compose from '@libs/compose'; import DateUtils from '@libs/DateUtils'; @@ -135,7 +136,6 @@ function ReportActionsList({ loadOlderChats, onLayout, isComposerFullSize, - reportScrollManager, }) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -150,6 +150,7 @@ function ReportActionsList({ } return cacheUnreadMarkers.get(report.reportID); }; + const reportScrollManager = useReportScrollManager(); const [currentUnreadMarker, setCurrentUnreadMarker] = useState(markerInit); const scrollingVerticalOffset = useRef(0); const readActionSkipped = useRef(false); @@ -251,6 +252,13 @@ function ReportActionsList({ }); }, [report.reportID]); + useEffect(() => { + InteractionManager.runAfterInteractions(() => { + reportScrollManager.scrollToBottom(); + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + useEffect(() => { // Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function? // Answer: On web, when navigating to another report screen, the previous report screen doesn't get unmounted, diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 3fb5741b60ac..2758437a3962 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -2,7 +2,6 @@ import {useIsFocused} from '@react-navigation/native'; import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useContext, useEffect, useMemo, useRef} from 'react'; -import {InteractionManager} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import networkPropTypes from '@components/networkPropTypes'; @@ -12,7 +11,6 @@ import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withW import useCopySelectionHelper from '@hooks/useCopySelectionHelper'; import useInitialValue from '@hooks/useInitialValue'; import usePrevious from '@hooks/usePrevious'; -import useReportScrollManager from '@hooks/useReportScrollManager'; import compose from '@libs/compose'; import getIsReportFullyVisible from '@libs/getIsReportFullyVisible'; import Performance from '@libs/Performance'; @@ -97,7 +95,6 @@ function ReportActionsView(props) { const prevIsSmallScreenWidthRef = useRef(props.isSmallScreenWidth); const isFocused = useIsFocused(); - const reportScrollManager = useReportScrollManager(); const reportID = props.report.reportID; const hasNewestReportAction = lodashGet(props.reportActions[0], 'isNewestReportAction'); @@ -118,10 +115,6 @@ function ReportActionsView(props) { useEffect(() => { openReportIfNecessary(); - - InteractionManager.runAfterInteractions(() => { - reportScrollManager.scrollToBottom(); - }); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -262,7 +255,6 @@ function ReportActionsView(props) { <> Date: Tue, 2 Jan 2024 13:00:11 +0100 Subject: [PATCH 06/14] do patch-package again --- .github/workflows/reassurePerformanceTests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 15ebaa2a1df7..213e67c743ef 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -32,12 +32,14 @@ jobs: rm -rf node_modules npm cache clean --force npm install --force + npx patch-package npx reassure --baseline git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours rm -rf node_modules npm cache clean --force npm install --force + npx patch-package npx reassure --branch - name: Read output.json From a05adff9c0a995daf59f02962d1a28d8fbe25535 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 14:01:51 +0100 Subject: [PATCH 07/14] postinstall update --- scripts/postInstall.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/postInstall.sh b/scripts/postInstall.sh index 339fdf25cb10..9c4fb22e0da2 100755 --- a/scripts/postInstall.sh +++ b/scripts/postInstall.sh @@ -4,13 +4,16 @@ ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 -# Run patch-package -npx patch-package # Install node_modules in subpackages, unless we're in a CI/CD environment, # where the node_modules for subpackages are cached separately. # See `.github/actions/composite/setupNode/action.yml` for more context. if [[ -z ${CI+x} ]]; then cd desktop || exit 1 + rm -rf node_modules + npm cache clean --force npm install fi + +# Run patch-package +npx patch-package \ No newline at end of file From 941ca049507298cfc8ecaf178a48b8bbaa5b26ee Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 14:24:53 +0100 Subject: [PATCH 08/14] undo postinstall --- .github/workflows/reassurePerformanceTests.yml | 2 -- scripts/postInstall.sh | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 213e67c743ef..15ebaa2a1df7 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -32,14 +32,12 @@ jobs: rm -rf node_modules npm cache clean --force npm install --force - npx patch-package npx reassure --baseline git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours rm -rf node_modules npm cache clean --force npm install --force - npx patch-package npx reassure --branch - name: Read output.json diff --git a/scripts/postInstall.sh b/scripts/postInstall.sh index 9c4fb22e0da2..339fdf25cb10 100755 --- a/scripts/postInstall.sh +++ b/scripts/postInstall.sh @@ -4,16 +4,13 @@ ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 +# Run patch-package +npx patch-package # Install node_modules in subpackages, unless we're in a CI/CD environment, # where the node_modules for subpackages are cached separately. # See `.github/actions/composite/setupNode/action.yml` for more context. if [[ -z ${CI+x} ]]; then cd desktop || exit 1 - rm -rf node_modules - npm cache clean --force npm install fi - -# Run patch-package -npx patch-package \ No newline at end of file From 454f8a13a304b8cc51f9149253cc83c696fad003 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 15:03:05 +0100 Subject: [PATCH 09/14] Backup current patches --- .github/workflows/reassurePerformanceTests.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 15ebaa2a1df7..50c80092b1fc 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -28,13 +28,24 @@ jobs: set -e BASELINE_BRANCH=${BASELINE_BRANCH:="main"} git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 + + # Backup current patches + cp -r ./patches/ ./patches_backup/ + git switch "$BASELINE_BRANCH" rm -rf node_modules npm cache clean --force npm install --force npx reassure --baseline + git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours + + # Restore patches from backup + rm -rf ./patches/ + cp -r ./patches_backup/ ./patches/ + npx patch-package + rm -rf node_modules npm cache clean --force npm install --force From e5568dc9afd23e36b808e71caaa30c8d60f11e4c Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 15:46:52 +0100 Subject: [PATCH 10/14] indentation --- .github/workflows/reassurePerformanceTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 50c80092b1fc..2c837b18e416 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -44,7 +44,6 @@ jobs: # Restore patches from backup rm -rf ./patches/ cp -r ./patches_backup/ ./patches/ - npx patch-package rm -rf node_modules npm cache clean --force @@ -64,3 +63,4 @@ jobs: DURATION_DEVIATION_PERCENTAGE: 20 COUNT_DEVIATION: 0 REGRESSION_OUTPUT: ${{ steps.reassure.outputs.content }} + From bf5b98027934ae7fee9af1c6af941df560552793 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 2 Jan 2024 16:03:15 +0100 Subject: [PATCH 11/14] undo reassurePerformanceTests --- .github/workflows/reassurePerformanceTests.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 2c837b18e416..932ade958c85 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -21,35 +21,19 @@ jobs: run: | git config --global user.email "test@test.com" git config --global user.name "Test" - - name: Run performance testing script shell: bash run: | set -e BASELINE_BRANCH=${BASELINE_BRANCH:="main"} git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 - - # Backup current patches - cp -r ./patches/ ./patches_backup/ - git switch "$BASELINE_BRANCH" - rm -rf node_modules - npm cache clean --force npm install --force npx reassure --baseline - git switch --force --detach - git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours - - # Restore patches from backup - rm -rf ./patches/ - cp -r ./patches_backup/ ./patches/ - - rm -rf node_modules - npm cache clean --force npm install --force npx reassure --branch - - name: Read output.json id: reassure uses: juliangruber/read-file-action@v1 From 356adf8953cc240b8cfd6a157d66ecfb50a59456 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Fri, 5 Jan 2024 13:25:35 +0100 Subject: [PATCH 12/14] cleanup reassurePerformanceTests --- .github/workflows/reassurePerformanceTests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 9ef68fd6a990..64b4536d9241 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -21,6 +21,7 @@ jobs: run: | git config --global user.email "test@test.com" git config --global user.name "Test" + - name: Run performance testing script shell: bash run: | From f23ef434799893d836736caa6b618e279ee37dea Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Fri, 5 Jan 2024 13:30:35 +0100 Subject: [PATCH 13/14] lint --- .github/workflows/reassurePerformanceTests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 64b4536d9241..a4d611b3e095 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -42,3 +42,4 @@ jobs: with: DURATION_DEVIATION_PERCENTAGE: 20 COUNT_DEVIATION: 0 + \ No newline at end of file From 1cf27adfadf30d119a986e3a90f440470eb64b1d Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Fri, 5 Jan 2024 13:32:06 +0100 Subject: [PATCH 14/14] add spaces after linting --- .github/workflows/reassurePerformanceTests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index a4d611b3e095..64b4536d9241 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -42,4 +42,3 @@ jobs: with: DURATION_DEVIATION_PERCENTAGE: 20 COUNT_DEVIATION: 0 - \ No newline at end of file