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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/jss/src/RuleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

const index = this.index.findIndex(v => v.key === rule.key);
if (index > -1) {
this.index.splice(index, 1)
}
}

/**
Expand Down