hicetnunc icon indicating copy to clipboard operation
hicetnunc copied to clipboard

Cleanup - Replace nested if statements

Open TezzardzGoneWild opened this issue 2 years ago • 0 comments

Several sections of code received some clean up, but no functionality change:

  • onReady included a nested if statement that could be expressed using a single if statement
  • the nested if statement used for filtering OBJKT sale type within creationsForSale can be expressed with two one-line if statements
  • metadata fields are set to null when the state is initialized to give a better indication of what will happen within the component
  • instances where getUserMetadata is called wrote to an intermediate variable and had multiple unnecessary if statements where writing null or undefined would have the same outcome
  • this.state.copied has been renamed to this.state.discordLinkCopied for clarity

Large if / else blocks can be intimidating to new contributors, and the main goal of this PR is to reduce the barriers for new developers wanting to contribute. Reducing the complexity of these functions should help with attracting new developers and preventing unintended side effects when touching these areas

TezzardzGoneWild avatar Nov 07 '21 02:11 TezzardzGoneWild