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

v4 - refresh no longer working #570

Closed
bcorporaal opened this issue Sep 3, 2023 · 4 comments
Closed

v4 - refresh no longer working #570

bcorporaal opened this issue Sep 3, 2023 · 4 comments

Comments

@bcorporaal
Copy link

I am trying to migrate code from Tweakpane v3 to v4. All is working well, except for the refresh function. The code using it that was working for v3 no longer works. Specifically, nothing happens.

Here is an example panel I'm working on:
Screenshot 2023-09-03 at 17 48 08
In the Colors section, clicking the arrows or the rnd buttons changes the palette value and triggers a refresh. Previously then the palette dropdown would update and the visualization would redraw. With v4 nothing happens. No changes, no errors.

Digging into the Tweakpane code and adding a few log statements, it seems that in the refresh function (line 1708) the children array it tries to iterate only has 1 child and that has isRefreshable = false. Given that there are multiple inputs and taps in this instance, I would imagine it needs to iterate more than 1 child.

Again, this all worked with v3, so I'm not sure what is going on.

@cocopon
Copy link
Owner

cocopon commented Sep 4, 2023

This small test code works fine in my environment:

const PARAMS = {someProp: 1};
const pane = new Pane();

// Adding some bindings
pane.addBinding(PARAMS, 'someProp');
pane.addBinding(PARAMS, 'someProp', {options: {'foo': 1, 'bar': 2}});

// Update the value outside the pane
PARAMS.someProp = 2;

// Refresh the pane
pane.refresh();
// or, pane.children[i].refresh() also works fine

It seems that more information about your environment is needed to reproduce the problem. Sharing a code snippet or a minimal environment would be helpful.

@bcorporaal
Copy link
Author

bcorporaal commented Sep 4, 2023

Thanks for your input. The pane.children[i[.refresh() comment got me thinking and I got it working. As you can see in the screenshot, I have multiple tabs. If instead of pane.refresh(), I use pane.pages[0].refresh(), it works for me.

Not sure if this is the intended behavior, but for me this works.

If you're curious, you can see it in my code for Toko, a library to extend p5.js. Here line 29 and onwards, I set up the 3 buttons, and line 55 is where I had to change it. (pane.tab is a shortcut to tweakpane.pages[0]).

@cocopon
Copy link
Owner

cocopon commented Sep 5, 2023

Thank you for the details! I found the cause and created a new issue: #571

@cocopon
Copy link
Owner

cocopon commented Sep 5, 2023

Fixed in 4.0.1.

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

2 participants