Open IuliiaHerets opened 1 week ago
Triggered auto assignment to @twisterdotcom (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #wave-collect - Release 1
@twisterdotcom FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Edited by proposal-police: This proposal was edited at 2024-10-01 20:48:11 UTC.
Error occurs when trying to add a tag named "some"
We are getting are tags list from here and when it's empty we are returning an array but tags list is supposed to be an {}
.When we have values in tags list it becomes an object that's why we don't see this error while editing tag
https://github.com/Expensify/App/blob/cba1457371a1466eecdb0f917c880131c063ad5b/src/libs/PolicyUtils.ts#L292-L295
And here when it's an empty array we are using an incorrect method to check
https://github.com/Expensify/App/blob/def32f4dfca7eb60e07f423528d0b49a09530c37/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx#L50
We can return {}
here instead of an empty []
https://github.com/Expensify/App/blob/cba1457371a1466eecdb0f917c880131c063ad5b/src/libs/PolicyUtils.ts#L292-L295
We should also check for other places where we have this issue and fix it. We should also fix type errors that comes from this change.
The system returns an error stating 'A tag with this name already exists' even though no tag named 'some' is present, which might indicate a system error.
In
We check if tags
has property tagName
to determine if the created tag already exist.
However, when we create a new workspace, the tags
object is an array
:
it will only be updated to an object when a tag is created.
And some
is a property of a Javascript's array
object, which leads to tags?.[tagName]
exists, make the error appears.
The same bug can happen with other array
properties aswell, such as every
, forEach
, etc.
object
array
:Update
to
else if (!Array.isArray(tags) && tags?.[tagName]) {
or
else if (Object.prototype.hasOwnProperty.call(tags, tagName)){
NA
What a weird bug. Easy to recreate.
Job added to Upwork: https://www.upwork.com/jobs/~021841480841839544675
Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External
)
Upwork job price has been updated to $125
I believe this may be a backend issue. The tags are supposed to be {}
on the frontend, and we have set them correctly. However, when we create a workspace, the tags are being set to []
instead. I think the backend should ensure that the tags are set to {}
.
https://github.com/Expensify/App/blob/3946b226d6367a719af5bc894546b95dc9b59fb4/src/libs/actions/Policy/Tag.ts#L639 https://github.com/Expensify/App/blob/3946b226d6367a719af5bc894546b95dc9b59fb4/src/libs/PolicyUtils.ts#L311
cc: @allroundexperts @twisterdotcom
Error occurs when trying to add a tag named "some"
checking on empty array is returning [Function some] https://github.com/Expensify/App/blob/1ed31aa7232050cc38ee4b2050ed56a6ccf80403/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx#L50
Check the lenght of the tags array if it is empty js will return false and skip the "else if" condition
} else if (tags?.[tagName] && tags.length) {
Checked on staging
ios native
https://github.com/user-attachments/assets/b599bb26-8aa1-4154-89c2-4f61e628cdf1
@twisterdotcom I think that a backend fix would be better. Can you please pull someone from the internal team to take a look? TY!
cc @yuwenmemon can you do this?
Lolwut this is odd
Open source finds only the best bugs.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.42-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): biruknew45+1289@gmail.com Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
The tag named "some" should be successfully created and saved without any issues.
Actual Result:
The system returns an error stating 'A tag with this name already exists' even though no tag named 'some' is present, which might indicate a system error.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/86eac403-a0cc-4077-938f-f5db1a43d1e7
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @allroundexperts