Commit Graph

305 Commits

Author SHA1 Message Date
Juho Teperi 64e2a584ec Move react key functions to utils ns 2020-04-19 18:02:13 +03:00
Juho Teperi 22a2841b45 Make functional Reagent components optional, using new opts parameter
Render/as-element and other functions now take additional parameter for
setting options.

Currently only option is :functional-reag-elements?,
if set to true, by default Reagent components are
created as Functions, which behave similarly to Classes,
but allow using Hooks.
2020-04-19 17:59:52 +03:00
Juho Teperi 63e118d2a0 Use React.memo to check if component should render 2020-04-19 17:56:01 +03:00
Juho Teperi 08da5dd87c Fix optimized builds 2020-04-19 17:56:01 +03:00
Juho Teperi 6b68815f24 Ensure render sees the up-to-date props 2020-04-19 17:56:01 +03:00
Juho Teperi 92bcf84504 Use regex to check error component names
Function names use $ instead of ., so allow both in regexes
2020-04-19 17:56:01 +03:00
Juho Teperi eaf8a48900 Comment out test failures due to shouldComponentUpdate differences 2020-04-19 17:56:01 +03:00
Juho Teperi ed968ae95f Setup cljs repl and try adding some performance benchmarks 2020-04-19 17:56:01 +03:00
Juho Teperi bbfb28b127 Restore old test code 2020-04-19 17:56:01 +03:00
Juho Teperi f0423a51f0 Remove temporary :< tag 2020-04-19 17:56:01 +03:00
Juho Teperi 9042db423f Test creating functional components 2020-04-19 17:56:01 +03:00
Juho Teperi 4526f4d1f9 Implement #439, make RAtom print output readable 2020-04-17 00:37:47 +03:00
Juho Teperi 68531569c0 Fix #399, fix React key check with :> shortcut 2020-04-16 23:46:17 +03:00
Juho Teperi 3ee1d65aa5 Fix #433, support className property with keyword class shortcut 2020-04-16 23:36:02 +03:00
Juho Teperi 58583db56d Add tests using Cljs bundle output with Karma
New :bundle target will generate JS tooling compatible output, which can
be processed with Webpack and passed to Karma.
2020-04-16 22:45:51 +03:00
Juho Teperi e338de9b84 Improve test coverage 2020-03-22 16:25:32 +02:00
Juho Teperi 666a80fd02 Enable test coverage reports 2020-03-22 15:22:11 +02:00
Juho Teperi 2339b2a01d Add few merge-props test cases 2020-03-22 13:10:36 +02:00
Anton Chikin bfca4e4d36 Fix merge-props without classes 2020-03-07 00:23:30 +03:00
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