Commit Graph

491 Commits

Author SHA1 Message Date
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 178aaee030 Update React 2020-02-05 22:47:42 +02:00
Juho Teperi 9a7372d8ec Fix missing parenthesis 2020-01-15 09:40:01 +02:00
Dan Peddle 02b5170bd2 include path in assert error
Including path helps track down which particular cursor is misbehaving.
2020-01-03 11:44:38 +01:00
Juho Teperi 6615b535c4 Remove old comment 2019-12-17 23:46:15 +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
Arne Brasseur e6b1e9794c Add support for Class.contextType
We already support the static contextTypes and childContextTypes from the legacy
context API. React has now added contextType to the new Context API to make it
easier to consume the context value.

https://reactjs.org/docs/context.html#classcontexttype
https://reactjs.org/blog/2018/10/23/react-v-16-6.html
2019-12-12 17:58:59 +01:00
Juho Teperi a9cace4e14 Tag all objects with infer warnings 2019-10-25 10:28:52 +03:00
Juho Teperi 7a974ecccd Fix #460: Add type hints for extern inference 2019-10-25 08:55:22 +03:00
Juho Teperi 7ddc3dad5a Fix #454, add missing gobj/set parameter 2019-10-17 14:18:15 +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 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 f91c97a70c Update create-class docstring example 2019-08-14 10:38:43 +03:00
Juho Teperi 35ff5d33dd Use DidMount for component mount order
WillMount lifecycle method is being deprecated. DidMount can also be
used to capture the mount order. WillMount is called first for top-most
component and last for the children. DidMount is the reverse, first for
children and last the top-most component.
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
Isaac Johnston ff9beb0375 Support shadow-cljs 2019-08-13 01:36:46 +03:00
Juho Teperi c787d2a851 Drop :export metadata from fource-update-all function
There doesn't seem to be any reason to export this function, and nothing
else is exported. Exporting function also prevents DCE, though in this
case this function probably only adds few bytes as the code include
is anyway used by Reagent applications.
2019-03-02 23:27:45 +02: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 2d2f66df2d Fix queue 2018-12-31 15:30:58 +02:00
Juho Teperi f86c01e0d0 Add note about component methods 2018-12-31 15:09:01 +02:00
Juho Teperi bc1d94956e Use object interop in RenderQueue 2018-12-31 15:05:13 +02:00
Juho Teperi b4789ed0f5 Update create-class doc strings 2018-12-31 15:04:10 +02:00
Juho Teperi 91b134aabb Remove :component-function and clean getting fn name 2018-12-31 14:38:15 +02:00
Juho Teperi b964ec0fb6 Fix render method 2018-12-31 13:45:29 +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 02ca507e15 Merge branch '#385' of https://github.com/hyperfiddle/reagent into hyperfiddle-#385 2018-12-31 12:54:33 +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
Hendrik Poernama 7b4d5ff9c1 Merge branch 'master' of github.com:reagent-project/reagent into extends-component 2018-12-16 12:02:30 +07:00
Hendrik Poernama 2f1c72882f Create component without create-react-class 2018-12-16 11:54:28 +07:00
Jim Berlage d2b974dec0 Simplify 2018-12-04 09:14:27 -06:00
Jim Berlage f5a192ab2e Simplify 2018-12-04 08:32:47 -06: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
Robin Nagpal 4b8daecca8 Update documentation for `run-in-reaction` 2018-08-02 11:38:31 -04:00
Robin Nagpal d1f98958b9 Update `in-context` and `deref-capture` documentation 2018-08-02 11:33:10 -04:00
Robin Nagpal 4f96b70d8d Document nit for wrap-render function 2018-08-02 11:09:50 -04:00
Robin Nagpal 821b9f917c minor cleanups of documentation 2018-08-01 20:37:06 -04:00
Robin Nagpal f84ed57d18 Merge branch 'master' into feature/docs-component-ratom-relation
# Conflicts:
#	project.clj
2018-08-01 20:17:43 -04:00
Robin Nagpal 49bdcefed4 Add documentation about how a component is added to watches of the ratom 2018-08-01 20:13:41 -04:00
Robin Nagpal 33d70e2140 Some more documentation 2018-08-01 15:44:07 -04:00
Robin Nagpal 36636caa95 Add some minimal docs 2018-07-31 10:12:25 -04:00
Robin Nagpal 71047c2dc5 local experiments 2018-07-30 15:35:28 -04:00
Karl Hardenstine b633a02d40 Comparing PartialFn to nil is false/unexceptional #385 2018-07-13 11:26:50 -04:00
Juho Teperi 9f2b492ff8 Remove unncessary let 2018-06-18 01:00:42 +03:00