-
Notifications
You must be signed in to change notification settings - Fork 18
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
Patch bad DOM: <img fallbackImage= ...> #29
Conversation
@mheiber do you have a reproducable case? this shouldn't be happening in any current version of react. Something similar to this should go in at some point but I need to think more about whether or not we want to be more aggressive than this |
@conorhastings thanks for following up. I can send a screenshot tomorrow, and this isn't a blocker. |
@mheiber thanks, no rush, running code would be preferable if possible, you can use https://esnextb.in/ with gists to access es6 imports etc... |
@conorhastings here's an example. Source code: Warning message in the console: These warnings go away when I make the change in this PR. React dev tools: |
@mheiber coool cool, what I would expect, doesn't appear to be getting into the actual dom just the virtual dom, I'll think about how to handle this some more and try to come to a conclusion this week if we should just merge this or go in another direction. |
relevant React issue: I added a comment on that issue asking what the best practice is. And you're right that the invalid props aren't making it to the actual DOM: |
@mheiber yup I'm aware of the react issue, there's ongoing debate over the best practice. https://twitter.com/natebirdman/status/759902308993937409 |
I'm thinking (based on discussion in the React issue) that |
@mheiber delete isn't ideal as it's very slow- https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/ |
@conorhastings that's why I want to avoid The warning they added to React is a mistake, IMO. |
@mheiber I think the warning makes sense, as in order to properly support web components they need to make all props pass through to the DOM. It follows the long term react pattern of giving warnings for breaking changes before breaking things, and only appears in development and not production which is relatively pragmatic. Currently the whitelist react is using is also relatively unmaintainable as html properties change. I'd prefer not to go with delete so I'm going to mull over other other potential options before deciding what to do here. |
@mheiber I think I'm going to go with this solution https://github.com/socialtables/react-image-fallback/pull/30/files as it will also prevent props that are spread in by consumers of the module and not just ones this component is directly responsible for. |
@conorhastings nice solution. I like the use of the html-attributes module much better than listing out all the possible attributes for an |
No description provided.