Allow setting disabled attribute on active-link#16
Open
jcowley wants to merge 1 commit intoalexspeller:masterfrom
Open
Allow setting disabled attribute on active-link#16jcowley wants to merge 1 commit intoalexspeller:masterfrom
jcowley wants to merge 1 commit intoalexspeller:masterfrom
Conversation
Author
|
@alexspeller: Any feedback on this one? |
Owner
|
Really sorry I am in the middle of an international move so have been neglecting OS stuff - I'd like to see a test of this before merging but the concept looks OK to me. |
Author
|
Thanks @alexspeller. Will look at adding a test. |
|
I've just stumbled upon this, while implementing infinite scroll with ember smoke and mirrors. The list contains models, represented with links wrapped with If I can help with something, just let me know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm using a computed property to disable a child link. The computed property gets set asynchronously when the model loads. When that happens, I get the dreaded "You modified *** twice in a single render" deprecation warning:
I believe this is occurring because the child link 'disabled' class gets applied, then ember-cli-active-link-wrapper kicks in and applies the 'disabled' class to the wrapper element. I could of course set
{{active-link disabledClass=false}}to prevent this; however, I need the wrapper element to have the 'disabled' class applied so that it disables the bootstrap nav item.This PR doesn't directly address the underlying issue of the double modification. All it does is allow for setting the disabled attribute on {{active-link}} itself rather than letting it be set dynamically based on the state of the children. Users can then manually disable the wrapper element.
For me, this fixes the double render issue because I can set my computed property directly on {{active-link}} so only one modification occurs during render.