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

[FEATURE] Re-render Only When Variable Changes #1078

Open
harshkhandeparkar opened this issue Apr 21, 2024 · 1 comment
Open

[FEATURE] Re-render Only When Variable Changes #1078

harshkhandeparkar opened this issue Apr 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@harshkhandeparkar
Copy link

Description of the requested feature

Using Hyprland's damage blink debug option, it can be seen that widgets re-render even if the variables used in them do not change. The re-render is triggered whenever a poll variable polls, even if its value remains the same as the previous.

It would be good to re-render widgets only if the new value of a variable is different from the previous to save resources.

Proposed configuration syntax

No response

Additional context

No response

@harshkhandeparkar harshkhandeparkar added the enhancement New feature or request label Apr 21, 2024
@harshkhandeparkar
Copy link
Author

I want to work on this issue. Is it as simple as adding an if condition on this line or something deeper needs to be taken care of or is there a better way to implement this? @elkowar

My proposed solution:

        if let Some(entry) = self.graph.scope_at_mut(scope_index).and_then(|scope| scope.data.get_mut(updated_var)) {
            if *entry != new_value {
                *entry = new_value;
                self.notify_value_changed(scope_index, updated_var)?;
            }
        }

I tested this on my system (although with only a few widgets, not extensively), and it seemed to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant