Skip to content

[BUG] Toggling expression mode on dropdowns with string values should preserve string value #4087

Description

@phillipivan

Make sure you're on the latest stable or beta build

  • I have tested this on the latest stable or beta release

Is this a bug in companion itself or a module?

  • I believe this to be a bug in companion and not a specific module

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When toggling to expression mode for a dropdown with a string value, the id value of the current selection becomes the expression value. However because that value becomes value and not 'value' actions or feedbacks that are expecting specific key values break until it is edited to include the ''. At that point toggling the option out of expression mode returns an error for a value not found in the dropdown list. I think this could be cleaner and auto handled by companion.

Steps To Reproduce

  1. Feedback with a dropdown selection:
Image 2. Toggle to expression mode, now the feedback can't return a value because it is looking for a known key: Image 3. Edit the expression to wrap the value in ' ': Image
  1. Now toggle out of expression mode, and the value can't be found in the drop down contents:
Image

Expected Behavior

I think this makes for a clumsy experience when moving between non-expression and expression mode, and ideally companion would handle this behind the scenes better.

Environment (please complete the following information)

- Companion Version: 4.3.0+9093
- OS: Win 11
- Browser: Firefox

Additional context

Module using:

  • Companion Module Base: 2.0.3

For reference the feedback callback from the above:

  callback: (feedback) => {
  	sub('versions', feedback.id, self)
  	if (!self.api) return null
  	switch (feedback.options.field) {
  		case 'major':
  			return self.api.versions.major
  		case 'minor':
  			return self.api.versions.minor
  		case 'muProcessor':
  			return self.api.versions.muProcessor
  		case 'type':
  			return MatVersionType[self.api.versions.type]
  		default: {
  			const _exhaustiveCheck: never = feedback.options.field
  			return _exhaustiveCheck
  		}
  	}
  },

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGSomething isn't workingNeeds beer!This needs discussion while drinking beerarea/guiGUI / Webapp related

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions