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

Fix for missing dynamic rules #1642

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bundas
Copy link

@Bundas Bundas commented Apr 5, 2023

Corresponding Issue(s):

What Would You Like to Add/Fix?

#1635

Todo

  • Add test(s) that verify the modified behavior
  • Add documentation if it changes public API

Expectations on Changes

Changelog

@Bundas Bundas requested a review from kof as a code owner April 5, 2023 16:59
@@ -114,7 +114,10 @@ export default class RuleList {
remove(rule) {
this.unregister(rule)
delete this.raw[rule.key]
this.index.splice(this.index.indexOf(rule), 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is by reference not working?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, it should work with indexOf, while only adding the -1 check, right? If help is needed, I can try myself. What else is needed to merge the PR? Some tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lack the greater context to effectively debug the reason why is 'find by reference' not working.

In fact, it should work with indexOf, while only adding the -1 check, right?

If we checked only for -1 it wouldn't be removing old styles

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is by reference not working?

I am not quite sure, but I think it has to do with the following:

{7233EC94-9A76-4DF6-8DDE-CA49C6CD6B0B}

When some dynamic rules are updated because the data might change, those new updated rules are not stored in the useStyles hook. So, finally when removeDynamicRules happens, we remove the old rule references, instead of the new ones. I think this fix handles that correctly, but some new test cases should be added. Would be very nice if a new version would be released soon, since JSS is still widely used.

@ernestostifano
Copy link

Hi @Bundas, just wanted to know if there are any updates about this. Can I help in some way? Cheers

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

Successfully merging this pull request may close these issues.

4 participants