Skip to content
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

[#173353526] Fix transaction details crash #1908

Merged
merged 4 commits into from
Jun 16, 2020

Conversation

Undermaken
Copy link
Contributor

Short description:
This PR fixes a bug on transaction details.
Due to a wrong statement the app try to render an empty text

Buggy code
stringValue && <SomeComponent> fails when stringValue===""
this is because:

  • undefined && <SomeComponent> -> undefined
  • "some text" && <SomeComponent> -> <SomeComponent>
  • "" && <SomeComponent> -> ""
    It goes fine only when stringValue is not undefined and with length > 0
before fixed
before fixed

@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Jun 16, 2020

Affected stories

  • 🐞 #173353526: [critical] crash sul dettaglio di alcune transazioni

Generated by 🚫 dangerJS

* @param text
*/
export const isNullyOrEmpty = (text: string | undefined | null) => {
return (text || "").trim().length === 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

why don't to use fromNullable ?
something like:

fromNullable(text).fold(false, t => t.trim().length===0)

Just a suggestion, I think your solution works fine too!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is definitely better
Update here b2647ce

@Undermaken Undermaken merged commit 3698229 into master Jun 16, 2020
@Undermaken Undermaken deleted the 173353526-fix-transaction-details-crash branch June 16, 2020 12:42
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.

3 participants