twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Finish Implementing Select/MultiSelect #3166

Open GARY121github opened this issue 1 year ago • 8 comments
trafficstars

refactor: improve generateEmptyFieldValue function

  • Optimize handling of MultiSelect and Select cases
  • Provide a default value for Select based on FieldSelectValue
  • Enhance code readability and maintainability

GARY121github avatar Jan 03 '24 20:01 GARY121github

CLA

Hello there and welcome to our project! By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement. Although we don't have a dedicated legal counsel, having this kind of agreement can protect us from potential legal issues or patent trolls. Thank you for your understanding.

Generated by :no_entry_sign: dangerJS against 055d25194732b91baad3dbd38e3b1b843e2f9e96

github-actions[bot] avatar Jan 03 '24 20:01 github-actions[bot]

hello @lucasbordeau , I am new to open source and I am still understanding the code base. Can you please help me to understand the issue more clearly?

GARY121github avatar Jan 03 '24 20:01 GARY121github

Also, could you please add a first jest test on this function? And update the PR title :)

charlesBochet avatar Jan 03 '24 20:01 charlesBochet

I cannot understand the issue properly can you please guide me?

case FieldMetadataType.MultiSelect: {
    // Handle MultiSelect-specific logic
    if (!backendSupportsMultiSelect) {
      throw new Error('MultiSelect not implemented on the backend yet');
    }
    // Additional MultiSelect handling
    break;
  }
  case FieldMetadataType.Select: {
    // Handle Select-specific logic
    const defaultSelectValue = {
      color: 'DEFAULT_COLOR', // Replace with the actual default color
      label: '',
      __typename: 'FieldSelectValue',
    };
    return defaultSelectValue;
  }
  default: {
    throw new Error('Unhandled FieldMetadataType');
  }

Is this code completing your requirements? I have separated them from the default case.

GARY121github avatar Jan 05 '24 16:01 GARY121github

@GARY121github It looks good but it's not what I see in your PR

charlesBochet avatar Jan 05 '24 17:01 charlesBochet

@GARY121github It looks good but it's not what I see in your PR

I have updated the code according to your explanation should I create a new PR

GARY121github avatar Jan 05 '24 17:01 GARY121github

Here is what I see: image

charlesBochet avatar Jan 05 '24 17:01 charlesBochet

@charlesBochet I have sent new PR can you please review and merge it

GARY121github avatar Jan 08 '24 16:01 GARY121github