Replace the old generateDefaultWorkspaceName with the new one#87706
Replace the old generateDefaultWorkspaceName with the new one#87706bernhardoj wants to merge 10 commits intoExpensify:mainfrom
Conversation
…the workspace name to buildPolicyData
|
@parasharrajat 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] |
| const [sessionEmail = ''] = useOnyx(ONYXKEYS.SESSION, {selector: emailSelector}); | ||
| const lastWorkspaceNumberSelectorWithEmail = (policies: OnyxCollection<Policy>) => lastWorkspaceNumberSelector(policies, sessionEmail); | ||
| const [lastWorkspaceNumber] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: lastWorkspaceNumberSelectorWithEmail}); | ||
| return generateDefaultWorkspaceName(sessionEmail, lastWorkspaceNumber, translate); |
There was a problem hiding this comment.
I think it makes more sense to have this as a hook. In the last PR, I'll replace all lastWorkspaceNumberSelector usage with this hook.
There was a problem hiding this comment.
Never mind, it wasn't a good idea. I'll delete this
|
Btw, after testing, I noticed that we create the workspace with the default name, but after deleting the workspace and creating it again, the number still increases. For example:
I believe it should be This happens on prod too. This is because after the workspace is deleted, the workspace data still stays on the onyx collection.
If we want to change/fix this, we can either completely remove the workspace from Onyx or use Lines 178 to 181 in 1f51f18 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89f55b26a3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| policyOwnerEmail: undefined, | ||
| makeMeAdmin: policy?.makeMeAdmin, | ||
| policyName: policy?.name, | ||
| policyName: policy?.name ?? '', |
There was a problem hiding this comment.
Avoid empty policy names in draft track-expense workspace creation
This path now passes policy?.name ?? '' into buildPolicyData when isDraftReportLocal is true. Because this commit also removed the fallback name generation inside buildPolicyData, flows where policy is unresolved will send an empty policyName, which can create unnamed workspaces (or fail validation) during auto workspace creation from track-expense drafts.
Useful? React with 👍 / 👎.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|

Explanation of Change
Fixed Issues
$ #66574
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisite:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4