Skip to content

feat: update Search/Reports page immediately following report actions #56772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from

Conversation

mkzie2
Copy link
Contributor

@mkzie2 mkzie2 commented Feb 12, 2025

Explanation of Change

feat: update Search/Reports page immediately following report actions

Fixed Issues

$ #55211
PROPOSAL: #55211 (comment)

Tests

Precondition: Create a workspace and enable workflow, approval, and delay submission (manually)

  • Submit Report
  1. Create an expense
  2. Go to Reports > Expense > Draft
  3. Submit the report by using the submit button in search
  4. Verify that the submitted report is removed with animation
  5. Create another expense
  6. Open the RHP report
  7. Submit the report
  8. Verify that the submitted report is removed with animation
  • Approve Report
  1. Go to Reports > Expense > Outstanding
  2. Approve a report by using the approve button in search
  3. Verify that the approved report is removed with animation
  4. Open another report in RHP
  5. Approve the report
  6. Verify that the approved report is removed with animation
  • Pay Report
  1. Go to Reports > Expense > Approved
  2. Pay a report by using the approve button in search
  3. Verify that the approved report is removed with animation
  4. Open another report in RHP
  5. Pay the report
  6. Verify that the approved report is removed with animation
  • Delete Report
  1. Go to Reports > Expense > All
  2. Create some expense
  3. Select the created expense and delete
  4. Verify that the report is removed with animation
  5. Open the RHP report
  6. Open Report detail > Delete expense
  7. Verify that the report is removed with animation
  • Verify that no errors appear in the JS console

  • Unapprove Report

  1. Go to Reports > Expense > Approved
  2. Open any RHP Report
  3. Open the report detail > Unapprove
  4. Verify that the report is removed with animation
  • Cancel payment
  1. Go to Reports > Expense > Paid
  2. Open any RHP Report
  3. Open the report detail > Cancel payment
  4. Verify that the report is removed with animation
  • Submit/Approve/Pay in all status
  1. Create an expense
  2. Go to Reports > Expense > All
  3. Submit/Approve/Pay the expense
  4. Verify that the report is not removed.
  5. Create another one
  6. Open the report RHP
  7. Submit/Approve/Pay the expense
  8. Verify that the report is not removed.

Offline tests

None

QA Steps

Precondition: Create a workspace and enable workflow, approval, and delay submission (manually)

  • Submit Report
  1. Create an expense
  2. Go to Reports > Expense > Draft
  3. Submit the report by using the submit button in search
  4. Verify that the submitted report is removed with animation
  5. Create another expense
  6. Open the RHP report
  7. Submit the report
  8. Verify that the submitted report is removed with animation
  • Approve Report
  1. Go to Reports > Expense > Outstanding
  2. Approve a report by using the approve button in search
  3. Verify that the approved report is removed with animation
  4. Open another report in RHP
  5. Approve the report
  6. Verify that the approved report is removed with animation
  • Pay Report
  1. Go to Reports > Expense > Approved
  2. Pay a report by using the approve button in search
  3. Verify that the approved report is removed with animation
  4. Open another report in RHP
  5. Pay the report
  6. Verify that the approved report is removed with animation
  • Delete Report
  1. Go to Reports > Expense > All
  2. Create some expense
  3. Select the created expense and delete
  4. Verify that the report is removed with animation
  5. Open the RHP report
  6. Open Report detail > Delete expense
  7. Verify that the report is removed with animation
  • Verify that no errors appear in the JS console

  • Unapprove Report

  1. Go to Reports > Expense > Approved
  2. Open any RHP Report
  3. Open the report detail > Unapprove
  4. Verify that the report is removed with animation
  • Cancel payment
  1. Go to Reports > Expense > Paid
  2. Open any RHP Report
  3. Open the report detail > Cancel payment
  4. Verify that the report is removed with animation
  • Submit/Approve/Pay in all status
  1. Create an expense
  2. Go to Reports > Expense > All
  3. Submit/Approve/Pay the expense
  4. Verify that the report is not removed.
  5. Create another one
  6. Open the report RHP
  7. Submit/Approve/Pay the expense
  8. Verify that the report is not removed.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2025-02-12.at.23.48.09.mov
Android: mWeb Chrome
Screen.Recording.2025-02-12.at.23.43.53.mov
iOS: Native
Screen.Recording.2025-02-12.at.23.49.54.mov
iOS: mWeb Safari
Screen.Recording.2025-02-12.at.23.46.38.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-12.at.23.38.15.mov
Screen.Recording.2025-02-12.at.23.38.50.mov
Screen.Recording.2025-02-12.at.23.38.59.mov
Screen.Recording.2025-02-12.at.23.39.39.mov
Screen.Recording.2025-02-13.at.00.04.19.mov
Screen.Recording.2025-02-17.at.15.15.39.mov
Screen.Recording.2025-02-17.at.15.15.52.mov
MacOS: Desktop
Screen.Recording.2025-02-12.at.23.52.32.mov

@mkzie2 mkzie2 marked this pull request as ready for review February 12, 2025 17:14
@mkzie2 mkzie2 requested a review from a team as a code owner February 12, 2025 17:14
@melvin-bot melvin-bot bot requested review from sobitneupane and removed request for a team February 12, 2025 17:14
Copy link

melvin-bot bot commented Feb 12, 2025

@sobitneupane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkzie2 we have conflicts

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 14, 2025

@luacmartins I updated.

@luacmartins luacmartins self-requested a review February 14, 2025 17:13
@luacmartins
Copy link
Contributor

@sobitneupane let's review this one once you're online!

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I pay using the Pay button in the row, the row gets removed and then reappears due to a payment error when reopening the Approved filtered reports. However, when I open the report in RHP and pay there, the row remains visible, and the error is displayed. Can we replicate this behavior when paying directly through the row?

Screen.Recording.2025-02-17.at.12.53.51.mov
Screen.Recording.2025-02-17.at.12.54.08.mov

@sobitneupane
Copy link
Contributor

@luacmartins While updating the status through RHP, should we close the report in RHP? For example, when I submit a report in Draft, it gets removed from the Draft. Should we close the RHP in this case? IMO, we should keep it open so the user can take multiple steps at once.

Screen.Recording.2025-02-17.at.13.05.48.mov

@sobitneupane
Copy link
Contributor

@shawnborton Could you please check the animation?

animation.mov
Screen.Recording.2025-02-17.at.13.12.00.mov

@sobitneupane
Copy link
Contributor

@mkzie2 It seems that the required changes for Unapprove and Cancel payment were missed.

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshots/Videos

MacOS: Chrome / Safari
Screen.Recording.2025-02-17.at.12.29.01.mov
Screen.Recording.2025-02-17.at.12.32.38.mov
Screen.Recording.2025-02-17.at.12.35.18.mov
Screen.Recording.2025-02-17.at.12.37.25.mov
Screen.Recording.2025-02-17.at.12.39.34.mov
Screen.Recording.2025-02-17.at.12.42.37.mov
Screen.Recording.2025-02-17.at.12.53.51.mov
Screen.Recording.2025-02-17.at.12.54.08.mov
Screen.Recording.2025-02-17.at.13.05.48.mov

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 17, 2025

When I pay using the Pay button in the row, the row gets removed and then reappears due to a payment error

@sobitneupane How can we get an error while paying?

@sobitneupane
Copy link
Contributor

I am getting the following error, so my best guess is that it's because the workspace is linked to the same bank account as my personal account.
Screenshot 2025-02-17 at 13 45 48

@luacmartins
Copy link
Contributor

I've asked @Kicu to take a look at this PR since he has a lot of context on Search and can help with the animations too.

@Kicu
Copy link
Contributor

Kicu commented Feb 27, 2025

I will look at this today before eod Europe timezone :)

Copy link
Contributor

@Kicu Kicu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey I spend some time trying to understand what is happening here and left some general comments.
There are a few surprising patterns here that I think need further discussions.

My main questions to @mkzie2 is:

  • can we not spread isAllStatus and hash all over the app? these are search-specific things (Reports in bottom menu) and should stay separate
  • can you take another look at how to use exiting animation without changing Opacity View

to @luacmartins and @sobitneupane

  • can we somehow simplify the hash usage? I remember Backend needs hash when running actions from search?
  • do we have any other patterns where we don't simply accept Onyx data returned from backend but instead build our own data? if no - then this PR should not be the place to introduce this I think (specifically refer to actions/Search lines 299-301)

@@ -163,6 +164,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const isPayAtEndExpense = isPayAtEndExpenseTransactionUtils(transaction);
const isArchivedReport = isArchivedReportWithID(moneyRequestReport?.reportID);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`, {selector: getArchiveReason});
const {currentSearchHash, isAllStatus} = useSearchContext();
const hash = isAllStatus ? undefined : currentSearchHash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question to @luacmartins In general why do we have to push search hash to these functions which didn't use them before?
In what contexts does the backend need to use hash?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm correct, the backend is not using the hash, this is purely used by the frontend to build optimistic data

needsOffscreenAlphaCompositing={shouldRenderOffscreen ? needsOffscreenAlphaCompositing : undefined}
exiting={shouldAnimateOnRemove ? Exiting : undefined}
onLayout={(e) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component (OpacityView) is being used by PressableWithFeedback which is used all over the app in crucial places.
We cannot add an onLayout on this animated component, since it might substantially slow down the app. This will result in multiple setState being run for every pressable component, multiple times.

Is there any other way to add this animation, without affecting OpacityView?

unapproveExpenseReport(moneyRequestReport);
}, [isMoneyRequestExported, moneyRequestReport, isDelegateAccessRestricted]);
unapproveExpenseReport(moneyRequestReport, isAllStatus ? undefined : currentSearchHash);
}, [isDelegateAccessRestricted, isMoneyRequestExported, moneyRequestReport, isAllStatus, currentSearchHash]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really try to not connect Reports that deeply to Search - these features are separate.
It is unfortunate that we need to pass down isAllStatus and currentSearchHash to be able to run animations.

We should try to come up with another way of updating.

@@ -343,14 +374,29 @@ function payMoneyRequestOnSearch(hash: number, paymentData: PaymentData[], trans
];

const optimisticData: OnyxUpdate[] = createOnyxData({isActionLoading: true});
const failureData: OnyxUpdate[] = createOnyxData({errors: getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage')});
const finallyData: OnyxUpdate[] = createOnyxData({isActionLoading: false});
const successData: OnyxUpdate[] = isAllStatus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search context is a bit crowded already, and I wonder if we actually need isAllStatus used in so many places in the app.
Can you write why we need isAllStatus? How does the search status change affect handling onyx data?

@@ -8250,7 +8319,7 @@ function getNextApproverAccountID(report: OnyxEntry<OnyxTypes.Report>, isUnappro
return getAccountIDsByLogins([nextApproverEmail]).at(0);
}

function approveMoneyRequest(expenseReport: OnyxEntry<OnyxTypes.Report>, full?: boolean) {
function approveMoneyRequest(expenseReport: OnyxEntry<OnyxTypes.Report>, full?: boolean, hash?: number) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a mistake to add optional hash to all these actions that are report centric.

These functions should not know about the existence of Search. Up until now everything worked nicely with these functions being separate, and now because of adding an animation when something is removed we are combining them together.
I would consider a different approach.

@luacmartins
Copy link
Contributor

luacmartins commented Feb 27, 2025

can we somehow simplify the hash usage? I remember Backend needs hash when running actions from search?

As far as API requests go, the hash usage should be restricted to the *OnSearch commands, since they actually use the hash to send http data back to the client.

do we have any other patterns where we don't simply accept Onyx data returned from backend but instead build our own data? if no - then this PR should not be the place to introduce this I think (specifically refer to actions/Search lines 299-301)

I think for Search, this is the first place where we build data that is NOT isActionLoading. I've been resistant to this since Search commands only work online and it's transient data so there's no point in optimistically build this data.

@@ -80,6 +80,7 @@ import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar';
import type {ActionHandledType} from './ProcessMoneyReportHoldMenu';
import ProcessMoneyReportHoldMenu from './ProcessMoneyReportHoldMenu';
import ExportWithDropdownMenu from './ReportActionItem/ExportWithDropdownMenu';
import {useSearchContext} from './Search/SearchContext';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I don't think we should connect this component to Search context since this component is used in the Inbox flow, not Search. I think we need to keep changes contained to the Search components since this is a Search feature

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luacmartins When the user opens the RHP from Search and performs actions like approving or paying a money request, we will need to use the hash to update the search results.

@@ -163,6 +164,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const isPayAtEndExpense = isPayAtEndExpenseTransactionUtils(transaction);
const isArchivedReport = isArchivedReportWithID(moneyRequestReport?.reportID);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`, {selector: getArchiveReason});
const {currentSearchHash, isAllStatus} = useSearchContext();
const hash = isAllStatus ? undefined : currentSearchHash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm correct, the backend is not using the hash, this is purely used by the frontend to build optimistic data

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 28, 2025

@Kicu

  • My idea in this issue is, we will remove the data from snapshot when we do the action like submit/approve/pay expense in successData, and then we can use exiting from animated view to execute the animation

  • About isAllStatus, if we do an action in all statuses, we should not remove the data from snapshot that why I need to add this variable.

  • If we do the action in RHP report, we need to get the current hash and do the same pattern at the point 1 to remove the data from snapshot.

Please let me know if you have a better suggestion. Thanks.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 5, 2025

@Kicu Any thought in my comment above.

@luacmartins
Copy link
Contributor

@Kicu is focused on a different project and unfortunately has no availability to help on this one.

@Kicu Any thought in my comment above.

I'm not sure that I follow the strategy here. Why are we removing data from snapshot when we just update the state/status of the report?

@sobitneupane would you be able to help @mkzie2?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 6, 2025

I'm not sure that I follow the strategy here. Why are we removing data from snapshot when we just update the state/status of the report?

@luacmartins For example, if we're in the draft and submit a report in search or RHP, this report should be removed from the draft if we submit it successfully. So I removed it in the success data to remove this immediately. If not, it's only removed if we refresh the page.

@sobitneupane
Copy link
Contributor

I'll review this PR and explore possible solutions. I'll provide an update as soon as possible.

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding so far:

  1. Different search results are returned from the backend based on the status.
  2. We need to use searchHash to update the search result stored in local storage.
  3. hash is required on components like MoneyReportHeader and ReportDetailsPage because users can open expense on RHP and perform different actions. To reflect those changes on search results, search results stored in onyx should be updated.
  4. I believe we can avoid the change made in actions/IOU if we use search-specific functions as suggested below.

@luacmartins With the approach suggested by @mkzie2, most of the changes made in the PR seem necessary.

@@ -80,6 +80,7 @@ import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar';
import type {ActionHandledType} from './ProcessMoneyReportHoldMenu';
import ProcessMoneyReportHoldMenu from './ProcessMoneyReportHoldMenu';
import ExportWithDropdownMenu from './ReportActionItem/ExportWithDropdownMenu';
import {useSearchContext} from './Search/SearchContext';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luacmartins When the user opens the RHP from Search and performs actions like approving or paying a money request, we will need to use the hash to update the search results.

@@ -236,10 +239,10 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
} else if (isInvoiceReport(moneyRequestReport)) {
payInvoice(type, chatReport, moneyRequestReport, payAsBusiness);
} else {
payMoneyRequest(type, chatReport, moneyRequestReport, true);
payMoneyRequest(type, chatReport, moneyRequestReport, true, hash);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkzie2 an we determine if the Expense Report is being opened from Search? If so, would it be possible to use payMoneyRequestOnSearch instead?

@luacmartins
Copy link
Contributor

@luacmartins When the user opens the RHP from Search and performs actions like approving or paying a money request, we will need to use the hash to update the search results.

I'm not sure this is needed. We have live Onyx updates, so any changes made to Onyx data should be reflected in any equivalent snapshot_ data, e.g. if report_1 is modified, any snapshot_<hash>.data.report_1 will be modified as well.

@sobitneupane
Copy link
Contributor

I'm not sure this is needed. We have live Onyx updates, so any changes made to Onyx data should be reflected in any equivalent snapshot_ data, e.g. if report_1 is modified, any snapshot_<hash>.data.report_1 will be modified as well.

@luacmartins, that's correct, changes are reflected in the snapshots. However, in our case, we need to remove the report from the snapshot.

We maintain different snapshots based on status. Changes made to the report are reflected in the snapshot, but when we approve an expense report, we need to remove it from the snapshot of outstanding expenses. These snapshots are returned from the backend, and I don’t think any filtering is done on the frontend to determine whether the report belongs to a particular status or not. @mkzie2, could you please verify this?

@luacmartins
Copy link
Contributor

luacmartins commented Mar 13, 2025

Yea, that's correct. Maybe in that case we should just re-trigger the search so update the view then. WDYT?

@sobitneupane
Copy link
Contributor

@luacmartins Yup, I believe we can do that.

Should we re-trigger the search after the user closes the RHP? One drawback is that the search will be re-triggered even if the user doesn't perform any action.

@mkzie2 Can we re-trigger the search after the user performs certain actions (like paying, approving, etc.), without requiring the search hash?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 14, 2025

@mkzie2 Can we re-trigger the search after the user performs certain actions (like paying, approving, etc.), without requiring the search hash?

Let me investigate if we can do that.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 14, 2025

Now we have two problems that need to be resolved:

  • Solution to remove the snapshot data when doing the action on search (Have a new idea here)

  • The exiting animation (Does not have the solution now).

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 18, 2025

@mkzie2 Can we re-trigger the search after the user performs certain actions (like paying, approving, etc.), without requiring the search hash?

@sobitneupane I tested this but it has a problem: If the user select a transaction at index 1, another one at index 51, another one at index 101. Re-trigger the Search API will not remove all of them because the size data of one query is only 50.

cc @luacmartins

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 24, 2025

@sobitneupane Any thought on my comment above.

@sobitneupane
Copy link
Contributor

Oops, Sorry. I missed it earlier.

I tested this but it has a problem: If the user select a transaction at index 1, another one at index 51, another one at index 101. Re-trigger the Search API will not remove all of them because the size data of one query is only 50.

I’m not sure I fully understand the case you mentioned. Could you please clarify? We want to re-trigger the search when the user performs an action by opening the report in the RHP.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 26, 2025

I’m not sure I fully understand the case you mentioned. Could you please clarify? We want to re-trigger the search when the user performs an action by opening the report in the RHP.

@sobitneupane I think it's the same; for example if we select an item with index 2 and the current offset is 100 I think the Search API with this offset will not remove the data we do action.

@luacmartins
Copy link
Contributor

Gonna make this a draft while we work on the updated solution

@luacmartins luacmartins marked this pull request as draft March 26, 2025 18:23
@sobitneupane
Copy link
Contributor

I think it's the same; for example if we select an item with index 2 and the current offset is 100 I think the Search API with this offset will not remove the data we do action.

Re-triggering the search would update the entire view. However, a downside is that the user would be sent back to the top of the list, causing the whole list to re-render, which doesn’t seem ideal.

@sobitneupane
Copy link
Contributor

@luacmartins This issue is becoming increasingly complicated.

The PR and idea proposed by @mkzie2 are mainly based on spreading search-specific elements like isAllStatus and hash across IOU functions. If we’re against this approach (as suggested by kicu in this comment), we should consider dropping the PR and opening the issue for new proposals.

@luacmartins
Copy link
Contributor

I agree. Let's do that. Sorry @mkzie2, but let's start fresh with a new proposal for this since the current one is not acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants