-
Notifications
You must be signed in to change notification settings - Fork 4k
Implementing optimistic violations for workspace categories and tags. #62627
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
Merged
Merged
Changes from all commits
Commits
Show all changes
145 commits
Select commit
Hold shift + click to select a range
dfbb0e1
pushing violations for tags
Tony-MK 8f99598
lint
Tony-MK 76fbf0c
lint
Tony-MK 21432cb
Merge branch 'main' into tags-violations
Tony-MK 8426522
Merge branch 'Expensify:main' into tags-violations
Tony-MK 8ad6eaf
setting tags violations
Tony-MK 8c6ac33
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 741aa02
prettier
Tony-MK 6be1636
category tests
Tony-MK 83f2d81
Merge branch 'main' into tags-violations
Tony-MK 2e1a232
tags test
Tony-MK 49bb64e
Merge branch 'Expensify:main' into tags-violations
Tony-MK f3d2be8
policy from usePolicy
Tony-MK a2d77de
Merge branch 'tags-violations' of https://github.com/Tony-MK/Expensif…
Tony-MK 01f481e
comments
Tony-MK c7c6d82
lint
Tony-MK 7e19133
fixing deps warning
Tony-MK 6700d1a
prettier
Tony-MK 8a5d9dd
Merge branch 'main' into tags-violations
Tony-MK 791050f
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK a9cca16
ignoring invoice reports
Tony-MK 0ba6830
performance tests
Tony-MK b9779cd
mig
Tony-MK 734b6b6
Merge branch 'main' into tags-violations
Tony-MK a278bb5
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 9951457
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK d3a1a64
refactoring
Tony-MK 5474a34
lint
Tony-MK 19107d2
tests
Tony-MK 05ba6e3
prettier..
Tony-MK d6e0248
spell check
Tony-MK 666e697
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 757b0e8
resolving conflicts
Tony-MK 3ffa2ed
prettier..
Tony-MK 11f6bba
tags..
Tony-MK 3476c2d
Merge branch 'Expensify:main' into tags-violations
Tony-MK 5cbdef2
update tags
Tony-MK 9a77965
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 693c6ad
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 2378d23
created usePolicyData hook
Tony-MK 418e1a9
convert params to policyData
Tony-MK 63e0d8c
converted renamePolicyCategory to accept policyData
Tony-MK c5470a2
refactored tests and perfomance tests
Tony-MK 42e2557
refactored other functions and pages to depend on usePolicyData
Tony-MK e9d6977
Merge branch 'main' into tags-violations
Tony-MK fdfec07
fixed policy and catergory tests
Tony-MK d177fd0
Created usePolicyData.test.ts
Tony-MK 0bb275f
fixed tests
Tony-MK 85c236a
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK b963ab3
Merge branch 'Expensify:main' into tags-violations
Tony-MK 7fe0452
lint
Tony-MK 2dd48ef
Merge branch 'Expensify:main' into tags-violations
Tony-MK 013fa7d
Merge branch 'Expensify:main' into tags-violations
Tony-MK a2e018c
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 0b5fa55
reverted dependency line in InviteReceiptPartnerPolicyPage.tsx by re…
Tony-MK 641931e
Moved 'usePolicyData' to it's own folder and create types file
Tony-MK 70496e6
Created 'usePolicyData' to own folder and split 'usePolicyData' into …
Tony-MK 72d9f86
fixing 'usePolicyData' catergories and tags empty value
Tony-MK cd59515
lint...
Tony-MK 708ee53
Merge branch 'Expensify:main' into tags-violations
Tony-MK bd60815
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK bcfbe79
Merge branch 'tags-violations' of https://github.com/Tony-MK/Expensif…
Tony-MK 481b895
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 677322c
fix: added dependencies useOnyx hooks in the usePolicyData hook and u…
Tony-MK 283af11
Merge branch 'Expensify:main' into tags-violations
Tony-MK bbcc3d0
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 95f1b2f
Merge branch 'tags-violations' of https://github.com/Tony-MK/Expensif…
Tony-MK 3ead6ac
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK ea93663
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK c15e9d1
Merge branch 'main' of https://www.github.com/Expensify/App into tags…
Tony-MK d9dcd7e
Merge branch 'main' into tags-violations
Tony-MK 33366b4
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 0d5cc59
Apply suggestions from code review: Removing whitespace
Tony-MK 73538c2
Removing whitespace
Tony-MK e0649fc
Merge branch 'Expensify:main' into tags-violations
Tony-MK e42a8f6
Refactor: Remove unnecessary policy checks before category and tag op…
Tony-MK c7818be
refactore: removed duplicate dependency 'transactions' prop from the …
Tony-MK 1b7173c
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 87a030e
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 37aa992
fix: update deleteWorkspaceCategories to accept an additional parameter
Tony-MK 2da5223
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 2226044
Add missing Onyx.set call to update policy in PolicyTagTest
Tony-MK 519199b
Merge branch 'main' into tags-violations
Tony-MK a60857d
Fix import order in PolicyTagTest to ensure proper module resolution
Tony-MK 695286a
Merge branch 'main' into tags-violations
Tony-MK afa1c3b
Merge branch 'main' into tags-violations
Tony-MK feecdf6
Merge branch 'main' into tags-violations
Tony-MK 49554bf
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK fa68042
applied suggestions
Tony-MK 5aff137
reverting check in setWorkspaceTagEnabled
Tony-MK c11f1fc
Merge branch 'main' into tags-violations
Tony-MK 4b3c02d
refactor: IOURequestStepCategory to use policyID for policy data
Tony-MK c8caabe
fix: ensure policy existence check before accessing areCategoriesEnabled
Tony-MK d5c94f2
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 9ee5710
lint
Tony-MK 80a0bf4
Merge branch 'main' into tags-violations
Tony-MK eac84a8
lint
Tony-MK 606cc9f
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 530921e
lint
Tony-MK 7df6c42
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 7e42904
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 62ba679
lint
Tony-MK 9718f48
refactor: improve test structure and organization in PolicyTagTest
Tony-MK eae79c3
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 362996a
refactor: PolicyTagTests.ts
Tony-MK bc3af87
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 839777b
refactor: lint
Tony-MK 2ae6a3a
prettier
Tony-MK 3b3a600
Merge pull request #62627 from Expensify/App/main
Tony-MK 393e451
lint
Tony-MK 5719caf
refactor: PolicyTagTest and ReportUtils tests to improve setup and im…
Tony-MK 0f6d13b
test: Improve rerender handling in PolicyTag tests for better state m…
Tony-MK 9784b27
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK a9f112d
refactor: reverted renamePolicyTagList and improved it's tests to b…
Tony-MK aaae69d
refactor: reverted renamePolicyTagList and improved it's tests to be…
Tony-MK d099f96
Merge branch 'tags-violations' of https://github.com/Tony-MK/Expensif…
Tony-MK 170defa
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK f7b76a9
refactor: update parameter names and improve handling of policy tag l…
Tony-MK 9519081
refactor: enhance pushTransactionViolationsOnyxData to handle reports…
Tony-MK aaa4437
refactor: change import of ReportTransactionsAndViolations to type im…
Tony-MK 607fbbf
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 1a9c7c6
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 0480e9a
:Merge branch 'main' of https://github.com/Expensify/App into tags-vi…
Tony-MK 34585ac
refactor: pushTransactionViolationsOnyxData to streamline policy upda…
Tony-MK a762a91
refactor: lint
Tony-MK c17ddc9
refactor: remove unused import from ReportUtils.ts
Tony-MK dd0fec0
refactor: optimize tag merging logic in pushTransactionViolationsOnyx…
Tony-MK d39d36d
Merge branch 'Expensify:main' into tags-violations
Tony-MK 9ea0182
Merge branch 'main' into tags-violations
Tony-MK 25197c4
refacting null updates
Tony-MK 9103d55
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 507ef5b
Merge branch 'main' into tags-violations
Tony-MK e062c0c
refactor: WorkspaceTagsSettingsPage to use policyTags from policyData
Tony-MK 4a49279
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK b1f49ef
Merge branch 'Expensify:main' into tags-violations
Tony-MK 4eedc8d
Merge branch 'Expensify:main' into tags-violations
Tony-MK e5f39ad
Merge branch 'Expensify:main' into tags-violations
Tony-MK 4be2485
Merge branch 'Expensify:main' into tags-violations
Tony-MK d4d0f6f
Merge branch 'Expensify:main' into tags-violations
Tony-MK 7a24e7f
refactor: renamed SearchReport to Report
Tony-MK 860c596
Merge branch 'tags-violations' of https://github.com/Tony-MK/Expensif…
Tony-MK c82bf94
Merge branch 'main' of https://github.com/Expensify/App into tags-vio…
Tony-MK 660c0c9
refactor: simplify getTripIDFromTransactionParentReportID function
Tony-MK 8849a80
lint
Tony-MK a1971ca
refactor: remove unused Report type import in SplitExpensePage
Tony-MK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import {useMemo} from 'react'; | ||
| import {useAllReportsTransactionsAndViolations} from '@components/OnyxListItemProvider'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import usePolicy from '@hooks/usePolicy'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {Policy, Report} from '@src/types/onyx'; | ||
| import type {ReportTransactionsAndViolationsDerivedValue} from '@src/types/onyx/DerivedValues'; | ||
| import type {OnyxValueWithOfflineFeedback} from '@src/types/onyx/OnyxCommon'; | ||
| import type PolicyData from './types'; | ||
|
|
||
| /** | ||
| * Retrieves policy tags, categories, reports and their associated transactions and violations. | ||
| * @param policyID The ID of the policy to retrieve data for. | ||
| * @returns An object containing policy data | ||
| */ | ||
| function usePolicyData(policyID?: string): PolicyData { | ||
| const policy = usePolicy(policyID); | ||
| const allReportsTransactionsAndViolations = useAllReportsTransactionsAndViolations(); | ||
| const [tags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, {canBeMissing: true}, [policyID]); | ||
| const [categories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`, {canBeMissing: true}, [policyID]); | ||
| const [reports] = useOnyx( | ||
| ONYXKEYS.COLLECTION.REPORT, | ||
| { | ||
| canBeMissing: true, | ||
| selector: (allReports) => { | ||
| if (!policyID || !allReports || !allReportsTransactionsAndViolations) { | ||
| return {}; | ||
| } | ||
|
|
||
| // Filter reports to only include those that belong to the specified policy and have associated transactions | ||
| return Object.keys(allReportsTransactionsAndViolations).reduce<Record<string, Report>>((acc, reportID) => { | ||
| const policyReport = allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; | ||
| if (policyReport?.policyID === policyID) { | ||
| acc[reportID] = policyReport; | ||
| } | ||
| return acc; | ||
| }, {}); | ||
| }, | ||
| }, | ||
| [policyID, allReportsTransactionsAndViolations], | ||
| ); | ||
| const transactionsAndViolations = useMemo(() => { | ||
| if (!reports || !allReportsTransactionsAndViolations) { | ||
| return {}; | ||
| } | ||
| return Object.keys(reports).reduce<ReportTransactionsAndViolationsDerivedValue>((acc, reportID) => { | ||
| if (allReportsTransactionsAndViolations[reportID]) { | ||
| acc[reportID] = allReportsTransactionsAndViolations[reportID]; | ||
| } | ||
| return acc; | ||
| }, {}); | ||
| }, [reports, allReportsTransactionsAndViolations]); | ||
| return { | ||
| transactionsAndViolations, | ||
| tags: tags ?? {}, | ||
| categories: categories ?? {}, | ||
| policy: policy as OnyxValueWithOfflineFeedback<Policy>, | ||
| reports: Object.values(reports ?? {}) as Array<OnyxValueWithOfflineFeedback<Report>>, | ||
| }; | ||
| } | ||
|
|
||
| export default usePolicyData; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type {Policy, PolicyCategories, PolicyTagLists, Report} from '@src/types/onyx'; | ||
| import type {ReportTransactionsAndViolationsDerivedValue} from '@src/types/onyx/DerivedValues'; | ||
| import type {OnyxValueWithOfflineFeedback} from '@src/types/onyx/OnyxCommon'; | ||
|
|
||
| type PolicyData = { | ||
| policy: OnyxValueWithOfflineFeedback<Policy>; | ||
| tags: PolicyTagLists; | ||
| categories: PolicyCategories; | ||
| reports: Array<OnyxValueWithOfflineFeedback<Report>>; | ||
| transactionsAndViolations: ReportTransactionsAndViolationsDerivedValue; | ||
| }; | ||
|
|
||
| export default PolicyData; |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.