Skip to content

Set up style mutation monitoring#2027

Merged
chenglou merged 1 commit intofacebook:masterfrom
chenglou:warn-style-mutation
Apr 24, 2015
Merged

Set up style mutation monitoring#2027
chenglou merged 1 commit intofacebook:masterfrom
chenglou:warn-style-mutation

Conversation

@chenglou
Copy link
Contributor

Fixes #2008
This works by storing the style and its copy onto the component, and do the appropriate comparison during _updateDOMProperties.

Copy link
Collaborator

Choose a reason for hiding this comment

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

will be? ;)

@sophiebits
Copy link
Collaborator

👍 otherwise I think.

@sophiebits
Copy link
Collaborator

@chenglou lgtm – can you rebase, change console.warn to warning, and remove the monitorCodeUse?

@sophiebits
Copy link
Collaborator

Also make the warning message use %s instead of manual concatenation – we're aiming to have all of the warning strings be static format strings.

@jimfb
Copy link
Contributor

jimfb commented Mar 10, 2015

@chenglou ping.

@chenglou
Copy link
Contributor Author

Sorry for the wait. Busy week.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should use assign({}, props.style) I think? Ok, that wasn't actually part of the PR :) nvm

@chenglou chenglou force-pushed the warn-style-mutation branch from 839f586 to 3af6891 Compare March 16, 2015 07:57
@chenglou
Copy link
Contributor Author

I updated the PR but I think currently it's not possible for me to get the owner name for the warning (_currentElement._owner is always null for DOMElement). Otherwise it's fine (warning message not as useful though).

@zpao

Edit: works now!

@sophiebits
Copy link
Collaborator

@chenglou if you rebase the owner thing should work.

This works by storing the style and its copy onto the component, and do
the appropriate comparison during `_updateDOMProperties`.
@chenglou chenglou force-pushed the warn-style-mutation branch from 3af6891 to 6e992fb Compare April 2, 2015 02:05
@chenglou
Copy link
Contributor Author

chenglou commented Apr 2, 2015

Done!

@chenglou
Copy link
Contributor Author

Merging then.

chenglou added a commit that referenced this pull request Apr 24, 2015
Set up `style` mutation monitoring
@chenglou chenglou merged commit 288c7ed into facebook:master Apr 24, 2015
@chenglou chenglou deleted the warn-style-mutation branch April 24, 2015 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop defensively copying style object in DOMComponent._updateDOMProperties

7 participants