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

Odd issue with some controls in customize not having a payload. #694

Closed
arthurwolf opened this issue Feb 21, 2024 · 1 comment
Closed

Odd issue with some controls in customize not having a payload. #694

arthurwolf opened this issue Feb 21, 2024 · 1 comment

Comments

@arthurwolf
Copy link

arthurwolf commented Feb 21, 2024

I'm working on having custom controls (i'll ultimately have a lot of them, custom inputs, custom outputs, and custom controls).

Just spent 3 hours tracking down a bug, and it came down to this: in the "customize" thingie:

 render.addPreset(
    Presets.classic.setup({
      customize: {
        control(data) {
          if (data.payload instanceof ButtonControl) {
            return CustomButton;
          }
          if (data.payload instanceof ProgressControl) {
            return CustomProgress;
          }
          if (data.payload instanceof ClassicPreset.InputControl) {
            return Presets.classic.Control;
          }
        }
      }
    })
  );

Some have a payload (most), but some do not (Inputs). So when you do the context.payload instanceof ClassicPreset.InputControl check, it'll be true for outputs but not for outputs...

What's going on here? Am I missing something? I've read the documentation a lot, and even some of the source code, and still have a hard time understanding what's going on.

Any help would be greatly appreciated.

Cheers.

(awesome project, started supporting on Patreon)

@arthurwolf
Copy link
Author

Closing as I found a workaround (even if I still don't get what's going on), and I don't want to waste any help considering how many questions I have... Sorry for the noise.

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

No branches or pull requests

1 participant