FIX: bufferedValuesString.split is not a function (PR #8463)

Fix an error bufferedValuesString.split is not a function. It is happening when bufferedValue is a positive boolean (checkbox value)

GitHub

You’ve signed the CLA, lis2. Thank you! This pull request is ready for review.

The interesting thing I see here is that both computed properties have the exact same definition if you ignore variables names.

function splitPipes(str) {
  if (typeof str === "string") {
      return str.split("|").filter(Boolean);
    } else {
      return [];
    }
}

And then:

@discourseComputed('buffered.value')
bufferedValues: splitPipes,

@discourseComputed('setting.defaultValues')
bufferedValues: splitPipes

This looks good to merge to me, pending Robin’s neat refactor.

@eviltrout nice one, thank you, fixed

1 Like