Commit Graph

93 Commits

Author SHA1 Message Date
Ben Alpert
64c9d9d762 Split out warning message for nested key warning
Also make sure to mark child array as validated in cloneElement as well.
2015-05-12 16:33:04 -07:00
Ben Alpert
f0bdadf85b Merge pull request #3857 from spicyj/dev-rckv
Set _reactChildKeysValidated in dev mode only
2015-05-11 17:06:18 -07:00
Ben Alpert
0c58f4f6b1 Set _reactChildKeysValidated in dev mode only 2015-05-11 17:02:49 -07:00
Paul O’Shannessy
5da94d6eb0 Followup to #3758 so we actually test things 2015-05-07 17:10:51 -07:00
Tomasz Kołodziejski
5ef0b416df IsMounted should always return a boolean.
Fixes #3814. isMounted used to return undefined if internalInstance
was undefined after component was unmounted.
2015-05-05 11:43:09 +02:00
Ben Alpert
8cf226e442 Fix infinite recursion in browsers with iterators
My old code here didn't work properly -- for a string child, getIteratorFn would return an iterator that gave each character as its own string, and we'd attempt to loop over that too.

Tests now work in Chrome again.
2015-04-29 00:21:00 -07:00
Ben Alpert
086636747f Add key warning to nested collections
Also when reusing elements in multiple contexts -- before we were mutating each element to indicate its validity; now we mutate the array containing it (which we create, in the case of rest-arg children).

Fixes #2496. Fixes #3348.
2015-04-27 14:41:25 -07:00
Reed Loden
3e8951e8c7 SSL/TLSize all the things! (convert http:// to https:// where appropriate)
Update links to use https:// where it is supported. There's probably a lot
more that could be fixed, but these are the core ones I found (especially
the download links in order to prevent MITM attacks). Note that there are
some fb.me links that will redirect to http:// even while accessed over
https://, but this seemed like the best way to fix those for now.

NOTE: Only non-third-party files were modified. There are references to
http:// URLs in vendored/third-party files, but seems appropriate to fix
upstream for those rather than editing the files.

Also, copy one image locally to the blog, as it was hotlinking to a site
that did not support https://.

Last, use youtube-nocookie.com instead of youtube.com for video embeds,
as the former doesn't try to set a cookie on load (privacy enhancement).
2015-04-18 16:49:32 -07:00
Jim
0185c68c91 Merge pull request #3615 from jsfb/enable-new-context
Switch to parent-based context.  Fixes #2112.
2015-04-09 13:21:26 -07:00
Ben Alpert
50e08d4269 Merge pull request #3627 from spicyj/mut-warn-clone
Refer to cloneElement in mutation warning
2015-04-08 15:33:56 -07:00
Ben Alpert
e60a26a682 Kill ReactDoNotBindDeprecated
No one uses this.
2015-04-08 15:15:02 -07:00
Ben Alpert
05f6e7de71 Refer to cloneElement in mutation warning 2015-04-08 14:51:17 -07:00
Jim
7d44917531 Switch to parent-based context. Fixes #2112. 2015-04-07 14:49:29 -07:00
Grant Timmerman
59a914aac0 Disable numeric element types 2015-03-26 10:07:56 -07:00
Grant Timmerman
3c9ea72795 Display error when trying to create an element of type boolean. Fixes #3478 2015-03-26 01:21:54 -07:00
Ben Alpert
4dde417214 Fix tests after merge
Test Plan: jest
2015-03-24 13:37:39 -07:00
Ben Alpert
1aa4e3c234 Merge pull request #3440 from spicyj/console-error
Use console.error to show stack trace in console
2015-03-24 13:30:01 -07:00
cpojer
fb23276178 Add warning for getDOMNode calls. 2015-03-17 14:08:04 -07:00
Ben Alpert
e791fccf58 Use console.error to show stack trace in console
Better version of #3277.

Test Plan: jest, grunt test
2015-03-17 13:39:04 -07:00
Ben Alpert
9a6fa5eb7d Merge pull request #3430 from fourcolors/patch-1
fix grammar in comments
2015-03-17 11:08:40 -07:00
Mihai Parparita
60a101eced Include the owner name when warning about createElement(null/undefined).
Makes it easier to find the callsite that needs to be fixed.
2015-03-16 22:05:29 -07:00
Sterling Cobb
b59e7e60b5 fix grammer in comments 2015-03-16 17:10:14 -06:00
Ben Alpert
f8672c7270 Fix grammar in warning message 2015-03-11 15:47:04 -07:00
Ben Alpert
d9e06462a3 Merge pull request #3383 from ariabuckles/proptype-warnings
[PropTypes] Add warnings if PropTypes return functions
2015-03-11 15:46:17 -07:00
Aria Buckles
206e69c403 [PropTypes] Make invalid proptype warning clearer
Addresses comments on #3383, making the invalid proptype specification
warning clearer and making the tests for it a bit clearer.
2015-03-11 15:36:51 -07:00
Aria Buckles
d973e32336 [PropTypes] Add warnings if PropTypes return functions
Summary:
Right now, if a component specifies a propType as, for example,
`myProp: React.PropTypes.shape`, without an actual shape
parameter, any prop type will be accepted, because
`React.PropTypes.shape` returns a function (the actual validator),
not an Error, currently indicating that propType checking passed.

This can create an unfortunate situation where a component looks
like it has fully specified `propTypes`, but in fact does not.

This commit addresses this by warning if a propType checker returns
anything non-falsy that is not an Error (currently all the library
PropTypes return null or an Error).

Test Plan:
Added a unit test; ran `jest` in the root repo directory.
Also ran `grunt lint` and `grunt test`
2015-03-11 15:09:18 -07:00
cpojer
ae7da3aadd foo.getDOMNode => React.findDOMNode(foo) 2015-03-10 17:17:21 -07:00
Ben Alpert
cff3f35bf7 Merge pull request #3321 from Smert/master
Bringing the code to one style.
2015-03-10 15:32:43 -07:00
Ben Alpert
b95fe57743 Merge pull request #3253 from jsfb/fix-comment-to-reflect-class-type-usage
Fix comment to reflect the new (non-deprecated) way of accessing a class type.
2015-03-10 15:31:50 -07:00
Paul O’Shannessy
0e797dffe4 Allow null and undefined values in non-frag object passed to PropTypes.node 2015-03-05 17:56:50 -08:00
dmitry
adb9b20f6d Bringing the code to one style. 2015-03-05 14:04:47 +02:00
Sebastian Markbage
a27c6d1690 Always use a static message formats
These are the only places that seems to be including environment specific
variables in the message format.

By ensuring that they're static, we make it easier to group logs by
format. I also ensure that I keep each addendum separate so that they can
be filtered/grouped separately.
2015-03-02 13:18:38 -08:00
Paul O’Shannessy
4bad1aacb6 Merge pull request #3275 from spicyj/gh-3222
Don't use undefined as parent name in key warning
2015-03-02 12:47:52 -08:00
Sebastian Markbåge
ecc4ad569a Merge pull request #3266 from sebmarkbage/cloneelement
Add cloneElement Implementation
2015-03-02 12:15:20 -08:00
Ben Alpert
7ebf7c46f5 ReactFragment counts as a node without warning
Fixes #3286.
2015-03-01 11:50:07 -08:00
Ben Alpert
d5fa14de1a Don't use undefined as parent name in key warning
Fixes #3222.
2015-02-26 15:20:37 -08:00
Sebastian Markbage
4adcee69a0 Add cloneElement Implementation
This is a new version of cloneWithProps but this one is moving out of
add-ons. Unlike cloneWithProps, this one doesn't have special logic for
style, className and children.

This one also preserves the original ref. This is critical when upgrading
from a mutative pattern where a child might have a ref on it.

It also preserves context, which is similar to how context would work when
it is parent based. It also ensures that we're compatible with the old
mutative pattern which makes updates easier.
2015-02-26 01:17:05 -08:00
Jim
29f6c7e774 Fix comment to reflect the new (non-deprecated) way of accessing a class type. 2015-02-24 11:18:17 -08:00
Paul O’Shannessy
ad31cfa4dc Warn when using constructor function directly
We no longer support the legacy factory style of calling component constructors
directly. We only support createElement or the wrapping of classes with
createFactory. Instead of letting this fail in a gross way as we try to run,
add a nice warning that shows up before the gross TypeError.
2015-02-19 13:57:48 -08:00
Henry Zhu
eba5d1365c lint: remove spaces from array brackets 2015-02-19 00:13:36 -05:00
Henry Zhu
07cfd66028 lint: remove spaces from object braces 2015-02-19 00:10:31 -05:00
Sebastian Markbage
377319b863 Forgotten string
We forgot this `%s` as this was converted.
2015-02-17 18:26:12 -08:00
Sebastian Markbage
67cf95c16d Avoid reading the property if hasOwnProperty is false
Easy with an Object.assign polyfill
2015-02-17 15:59:01 -08:00
Sebastian Markbåge
de3ecabd6c Merge pull request #3148 from hmarr/fix-nan-mutation-warning
Prevent NaN props from triggering warnings
2015-02-17 15:41:18 -08:00
Sebastian Markbåge
cf4bef8bd7 Merge pull request #3171 from sebmarkbage/moarwarnings
Moar Warnings
2015-02-17 15:09:33 -08:00
Sebastian Markbage
2490289c4a Warn if getDOMNode or isMounted is accessed in render
This is an anti-pattern that can be easily avoided by putting the logic
in componentDidMount and componentDidUpdate instead.

It creates a dependency on stale data inside render without enforcing
a two-pass render.
2015-02-17 11:49:20 -08:00
Sebastian Markbage
3587460675 Warn if accessing .type on a factory
This was an important convenience as an upgrade path but shouldn't be
necessary if you're using best-practice of calling createFactory in the
consuming component.
2015-02-17 11:06:54 -08:00
Harry Marr
198aabaafb Prevent NaN props from triggering warnings
Previously, `checkAndWarnForMutatedProps` would flag `NaN` props as
having been mutated, because `NaN !== NaN`. This prevents that warning
from being emitted by explicitly checking for `NaN`s.
2015-02-14 10:06:55 +00:00
Henry Zhu
74726f0af5 remove space before round brace in function expressions 2015-02-13 23:41:53 -05:00
Sebastian Markbage
f5038829d8 Moar warnings with solid prefixes!
This ensures that we have a prefix that can be easily identified in logs
so that we can filter out warnings based on their prefix.

This also turns the remaining two monitorCodeUse callers into warnings.
We'll probably still use monitorCodeUse until we know if we want to
deprecate but most releases should only have warnings.
2015-02-12 13:37:19 -08:00