Commit Graph

286 Commits

Author SHA1 Message Date
Juho Teperi 5ead085c93 Replace component stack with just component name in error messages
- Completely remove component-path function
- Remove component stack information from error messages
- Test that component stack information is availble using Error Boundary
2020-02-28 14:39:33 +02:00
Juho Teperi c70f4f9c4e Add missing indent to test code 2020-02-05 23:34:11 +02:00
Juho Teperi ff4c9a6031 Remove dom functions from core ns 2020-02-05 23:15:05 +02:00
Juho Teperi 106e5d86ca Deprecate component-path in core ns 2020-02-05 23:13:57 +02:00
Juho Teperi 2027a2d888 Expected value first in tests, use direct comparsion instead of re-find 2020-02-05 23:04:56 +02:00
Juho Teperi 2b5c464f35 Remove some local defs from test ns 2020-02-05 23:01:27 +02:00
Juho Teperi c2bf3c0407 Remove found-in test checker, use = for better errors 2020-02-05 22:53:42 +02:00
Juho Teperi ecbbc60d95 Add Kondo config and lint code 2020-02-05 22:48:54 +02:00
Juho Teperi 9173f453b5 Remove deprecated interop macros 2020-02-05 22:48:37 +02:00
Juho Teperi 40e1ca306b Test cursor assertion only if assertions are enabled 2020-01-15 10:57:36 +02:00
Juho Teperi d70ac1e351 Add cursor assert test 2020-01-15 10:30:23 +02:00
Juho Teperi 8f9045311c Extern fix for npm prod build 2019-12-17 02:58:38 +02:00
Juho Teperi 6cb6561ba6 Use component constructor to keep track of mount order
Previous change (35ff5d33dd) started using ComponentDidMount to keep
track of component mount order. This affected the order in which this
was called, previously ComponentWillMount was called the first for
parent components and then for children. ComponentDidMount was called
first for children etc. To work around this, the mount order was
reversed when updating components after ratom updates.

Problem with this is, that when only some components are rerendered,
they get new numbers, but their parents don't:

(given components c, b, a)

**0.8.1**

c 1 > b 2 > a 3

a rerendered
c 1 > b 2 > a 4

b rerendered
c 1 > b 5 > a 6

**35ff5d33dd**

c 3 > b 2 > a 1

a rerendered
c 3 > b 2 > a 4 (BROKEN)

b rerendered
c 3 > b 6 > a 5 (BROKEN)

Best way to fix this is to revert back to old way, where parents get the
smaller number, this was re-rendering children doesn't change the order.
To implement this the mount-order can be stored in component
constructor, which seems to work similarly to ComponentWillMount.

> The constructor for a React component is called before it is mounted.

> UNSAFE_componentWillMount()... Generally, we recommend using the constructor() instead for initializing state.
2019-12-17 02:30:25 +02:00
Juho Teperi 07bfa901ac Add static contextType test 2019-12-17 02:21:05 +02:00
Juho Teperi a9cace4e14 Tag all objects with infer warnings 2019-10-25 10:28:52 +03:00
Juho Teperi 078976de26 Fix #452, Fix missing key warning where message contains fn literal 2019-10-02 15:37:56 +03:00
Juho Teperi 88fa3cc4ab Improve error boundary docs and fix tests 2019-10-02 15:37:21 +03:00
Juho Teperi edb3d2d322 Document using getDerivedStateFromError with error boundaries 2019-10-02 12:59:00 +03:00
Juho Teperi 094a29b9df Fix accessing js state in optimized build 2019-08-14 10:53:05 +03:00
Juho Teperi d4f14900da Improved support for new lifecycle methods & better docs
- separate getInitialState and constructor, they work differently
- getDerivedStateFromProps and Error
- getSnapshotBeforeUpdate
- Improved docstring for create-class
2019-08-14 10:38:43 +03:00
Juho Teperi 2f9e91d697 Add support for UNSAFE_ lifecycle methods & use for impl and tests 2019-08-14 10:38:43 +03:00
Juho Teperi ddd7f9a070 Fix infer externs problem in with-let macro, fixes #420 2019-01-10 21:04:27 +02:00
Juho Teperi d4038cb911 Deprecate reagent.interop ns, fixes #419 2019-01-04 11:46:48 +02:00
Juho Teperi 91b134aabb Remove :component-function and clean getting fn name 2018-12-31 14:38:15 +02:00
Juho Teperi 065acffbb7 Fix convert-props test case 2018-12-31 13:45:37 +02:00
Juho Teperi f6ec863f6b Fix component creating and hiccup class shortcut 2018-12-31 13:18:39 +02:00
Juho Teperi 16d8021e89
Merge branch 'master' into fix-array-ops 2018-12-31 13:07:05 +02:00
Juho Teperi a1953f2733 Add test for PartialFn equiv 2018-12-31 12:55:30 +02:00
Juho Teperi f7ca1ff8ff Add class-names utility function 2018-12-31 12:49:37 +02:00
Juho Teperi 18143e6e97 Fix :class collection with merge-props 2018-12-31 11:04:50 +02:00
Juho Teperi 364e19191e Merge branch 'n-props' of https://github.com/jimberlage/reagent into jimberlage-n-props 2018-12-31 10:47:36 +02:00
Juho Teperi 3bd90a26ec Clean new create-class and remove create-react-class from tests 2018-12-31 10:37:43 +02:00
Jim Berlage e31192fd31 Allows for an arbitrary number of props in merge-props 2018-12-03 16:16:06 -06:00
Juho Teperi 62f87292a2 Fix #401 if jsprops is nil before adding key, key is lost
If jsprops was nil before key oset call, oset created a new object for
the jsprops, but because the return value from oset was not used, the
object was lost.
2018-11-14 22:31:50 +02:00
Juho Teperi fe4f348f12 Test not= exception for dev builds only
Logging is not enabled for optimized builds
2018-05-04 19:25:34 +03:00
Juho Teperi c8cc7f996b Add test case for not= exception handling
Test case adapted from code by atroche: https://github.com/reagent-project/reagent/pull/344#issuecomment-384882866
2018-05-04 19:18:51 +03:00
Juho Teperi 5892174a12 Workaround for browser-npm minified error 2018-05-04 18:58:05 +03:00
Juho Teperi 60f7b4bc0c Remove :> component type assertion
Component could be plain JS object with some private React properties,
and it is not easy to check for this. Instead just allow all value for
:> but check that React will throw error from createElement.

Fixes #369
2018-05-04 18:47:45 +03:00
Juho Teperi 0c0ffc626a Context default value is for cases without provider 2018-05-04 18:14:48 +03:00
Juho Teperi cb02310b68 Add tests for new React context 2018-05-04 17:52:12 +03:00
Juho Teperi e1019a1c9c Check if value is named before calling name 2018-05-04 16:10:41 +03:00
Juho Teperi 606b321d2f Fix keywords and symbols in :class
Fixes #367
2018-04-27 23:20:52 +03:00
Juho Teperi 4a8ac5cd83 Fix problem with custom HTML element property name code
Custom HTML element property name code accidentally modified cache
object for normal HTML elements, which can cause Reagent to lose correct
mappings for properties like className, htmlFor and charSet.
2018-04-27 23:17:25 +03:00
Juho Teperi b7304d0f3f Fix aget/aset use with objects
This removes the interop macros which used aget/aset and prevented
Closure naming mangling, now normal property and method access is used
where possible, and goog.object used when using variable keys. Further
testing is needed to ensure this works correctly with Closure, as there
are some properties that are used with goog.object in one place, and as
property in another.

Fixes #324
2018-04-19 17:25:37 +03:00
Juho Teperi ad96d3cbbd Ensure prerender code is not evaluated during tests 2018-04-16 20:50:32 +03:00
Juho Teperi 601da7cc1d Merge branch 'test-browser-node-prod' into react-16-try2 2018-04-03 11:00:46 +03:00
Juho Teperi 12d590ff15 Document React 16 problems with npm-deps 2018-04-03 10:53:05 +03:00
Juho Teperi efe84857b9 Fix fragment key test case 2018-04-03 10:42:25 +03:00
Juho Teperi e095696bcc Use React 16 and simplify test setup 2018-04-03 10:33:01 +03:00
Juho Teperi 54d9b8eb78
Merge pull request #352 from reagent-project/hiccup-fragment
Implement :<> hiccup tag for fragments
2018-04-03 09:42:02 +03:00