:did-remount
is now:will-remount
, the name matches semantics closely- Added support for soft-deprecated lifecycle methods prefixed with
UNSAFE
::unsafe/will-mount
and:unsafe/will-update
- Added a wrapper for React's
useLayoutEffect
hook:use-layout-effect!
- Added Reagent-like
:>
syntax for interop with React components
- Fixed
fragment
macro not supporting optional attributes - Fixed crashing in projects using Rum w/o ClojureScript dependency
- Fixed
rum/local
&rum/reactive
components not being updated whenrum/static
is enabled #221
- Added missing
:did-update
and:key-fn
to specs
- Changed the order of arguments in
use-reducer
'sreducer-fn
to match React #213 - String attribute keys won't be camel cased in ClojureScript, allowing custom attributes #129
- Added assertions to check incorrect mixin keys #96
- Added
rum.core/set-warn-on-interpretation!
that enables warnings when compiler emits intepretation calls 66d352 - Added README section about Hiccup pre-compilation and interpretation #103
- Fixed
defcontext
macro #214
- Upgraded to ClojureScript 1.10.773
- Removed custom update scheduling mechanism (hopefully doesn't break anything)
- Replaced Sablono with Daiquiri, reworked Sablono fork (in case if you are depending on Sablono)
- Ported Sablono's test suite
- Added unit tests runner on Node
- Added alternative Hiccup syntax for React.Fragment
:<>
- Rum now requires Clojure 1.9.0
- Upgraded to ClojureScript 1.10.597
- Upgraded to React 16.8.6
- Deprecated usage of string refs
- Deprecated legacy React Context API of string refs
- Added
deps.edn
- Added
use-state
,use-reducer
,use-effect!
,use-callback
,use-memo
anduse-ref
hooks - Added
rum.lazy-loader
ns andsuspense
component - Added
fragment
component - Added JS SSR API (#105)
- Added React Context API
- Changed component's
displayName
to a fully qualified var name e.g.app.core/button
- Added
React.createRef
API - Added adapter for JavaScript React components to be used in Rum with a fallback hook to render on JVM
- Fixed
:type
attribute value serialization on JVM SSR (#120) - Fixed an error when calling
rum/with-key
on multiple return components on JVM SSR (#185) - Fixed string escaping for
:class
and:type
attribute values (#93) - Fixed unsused components not removed in production builds
- Fix render-all to forbid forceUpdate on falsy comp (#193, thx @FieryCod)
- Docstrings for https://cljdoc.org/d/rum/rum
- Server-render on-* event handlers with string values
0.11.0 (thx Roman Liutikov & Alexander Solovyov, #151)
- [ BREAKING ]
contextTypes
andchildContextTypes
should be specified through:static-properties
instead of:class-properties
- React 16.2.0, Sablono 0.8.1
- Added
rum/portal
method - Added
:did-catch
lifecycle callback - Added
rum/hydrate
and updated SSR output to match React’s
- React 15.4.2-0, Sablono 0.7.7
- Render boolean
aria-*
values as strings (thx r0man, #114) - Escape attributes during server-side rendering (thx Alexander Solovyov, #115)
- Fixed server-side rendering discrepancy (#99)
- Sablono 0.7.5, React 15.3.1-0
- Sablono 0.7.4 fixes the issue with controlling components refusing to change value if non-string value was used
- React 15.3.0-0
- Throw error when
<
is misplaced indefc
(thx Martin Klepsch, #88, #90)
- Sablono 0.7.3 fixes the issue when IE lost keystrokes in controlled inputs/textarea (#86)
- React 15.2.1-1
- Warn when
rum.core/react
is used withoutrum.core/reactive
(thx Martin Klepsch, #82, #87)
- Ability to use
:pre
and:post
checks inrum.core/defc
(thx Martin Klepsch, #81)
- Fixed regression of
displayName
in 0.10.0 - Bumped React to 15.2.0
- Fixed a bug when
:before-render
and:will-update
weren’t called on subsequent renders
- Made
rum.core/state
public again :before-render
should be called on server-side rendering too (thx Alexander Solovyov, #79)
A big cleanup/optmization/goodies release with a lot breaking changes. Read carefully!
- [ BREAKING ]
cursor
got renamed tocursor-in
. Newcursor
method added that takes single key (as everywhere in Clojure) - [ BREAKING ]
rum/mount
returnsnil
(because you shouldn’t rely on return value of ReactDOM.render) - [ BREAKING ]
:transfer-state
is gone. All of component’s state is now transferred by default. If you still need to do something fancy oncomponentWillReceiveProps
, new callback is called:did-remount
callback - [ BREAKING ] removed
cursored
andcursored-watch
mixins. They felt too unnatural to use - [ BREAKING ] removed
rum/with-props
(deprecated since 0.3.0). Userum/with-key
andrum/with-ref
instead - [ BREAKING ] server-side rendering no longer calls
:did-mount
(obviously, that was a mistake) - [ BREAKING ]
:rum/id
is gone. If you need an unique id per component, allocate one in:init
as store it in state under namespaced key
When upgrading to 0.10.0, check this migration checklist:
- Change all
rum/cursor
calls torum/cursor-in
- Find all
:transfer-state
mixins.- If the only thing they were doing is something like
(fn [old new] (assoc new ::key (::key old)))
, just delete them. - If not, rename to
:did-remount
- If the only thing they were doing is something like
- Check if you were using
rum/mount
return value. If yes, find another way to obtain component (e.g. viaref
,defcc
etc) - Replace
rum/with-props
withrum/with-key
,rum/with-ref
or:key-fn
- Check that you weren’t relying on
:did-mount
in server-side rendering
Now for the good stuff:
- Cursors now support metadata,
alter-meta!
etc - Cursors can be used from Clojure
- Added
:key-fn
to mixins. That function will be called before element creation, with same arguments as render fn, and its return value will be used as a key on that element - Mixins can specify
:before-render
(triggered atcomponentWillMount
andcomponentWillUpdate
) and:after-render
(componentDidMount
andcomponentDidUpdate
) callback - Added
rum/ref
andrum/ref-node
helpers, returning backing component and DOM node - Some client-side API functions added to server version (
dom-node
,unmount
,request-render
etc). Their implementation just throws an exception. This is to help you write less conditional directives in e.g.:did-mount
or:will-unmount
mixins. They will never be called, but won’t stop code from compiling either.
And couple of optimizations:
- Rum now makes use of staless components (nothing for you to do, if your component is defined via
defc
with no mixins, it’ll be automatically compiled to stateless component) - Rum will use React’s batched updates to perform rendering on
requestAnimationFrame
in a single chunk - Streamlined internals of component construction, removed
render->mixin
,args->state
,element
andctor->class
- Added
rum.core/derived-atom
, a function that let you build reactive chains and directed acyclic graphs of dependent atoms. E.g. you want*c
to always contain a value of*a
plus a value of*b
and update whenever any of them changes - Added
rum.core/dom-node
helper that takes state and finds corresponding top DOM node of a component. Can be called in mixins after initial render only - Fixed compatibility of
with-key
on nil-returning component in server rendering (thx Alexander Solovyov, #73)
- Better support for server-side rendering of SVG
- [ BREAKING ] Rum used to support multiple ways to specify attributes. You would expect that both
:allow-full-screen
,:allowFullScreen
and"allowFullScreen"
would be normalized toallowfullscreen
. As a result, you have to face three problems:- how do I decide which variant to use?
- how do I ensure consistency accross my team and our codebase?
- find & replace become harder
Starting with 0.9.0, Rum will adopt “There’s Only One Way To Do It” policy. All attributes MUST be specified as kebab-cased keywords:
Attribute | What to use | What not to use |
---|---|---|
class | :class |
:class-name :className |
for | :for |
:html-for :htmlFor |
unescaped innerHTML | :dangerouslySetInnerHTML { :__html { "..." }} |
|
uncontrolled value | :default-value |
:defaultValue |
uncontrolled checked | :default-checked |
:defaultChecked |
itemid, classid | :item-id , :class-id |
:itemID :itemId :itemid |
xml:lang etc | :xml-lang |
:xml/lang :xmlLang "xml:lang" |
xlink:href etc | :xlink-href |
:xlink/href :xlinkHref "xlink:href" |
xmlns | not supported |
To migrate to 0.9.0 from earlier versions, just do search-and-replace for non-standard variants and replace them with recommended ones.
- Improved server-side rendering for inputs (#67 & beyond)
- Compatible server-side rendering of components that return nil (#64)
- Upgraded React to 15.1.0
rum/render-static-markup
call for pure HTML templating. Use it if you’re not planning to connect your page with React laterrum/def*
macros now correctly retain metadata that already exists on a symbol (thx aJchemist, #62)
- Migrated to React 15.0.1
- Optimized server-side rendering (~4× faster than Rum 0.7.0, ~2-3× faster than Hiccup 1.0.5)
- Server-side rendering via
rum/render-html
(thx Alexander Solovyov)
- [ BREAKING ] Updated to React 0.14.3 (thx Andrey Antukh, #53)
- Added
:class-properties
to define arbitrary properties on a React class (thx Karanbir Toor, #44) - [ BREAKING ] Removed support for
:child-context-types
and:context-types
. Use{ :class-properties { :childContextTypes ..., :contextTypes ... } }
instead.
- Check for
setTimeout
in global scope instead of in window (thx Alexander Solovyov, #43)
- Fixed bug with rum macros emitting wrong namespace. You can now require
rum.core
under any alias you want (thx Stuart Hinson, #42)
- [ BREAKING ] Core namespace was renamed from
rum
torum.core
to supress CLJS warnings
- Upgraded to React 0.13.3, Sablono 0.3.6, ClojueScript 1.7.48
- New API to access context:
child-context
,child-context-types
,context-types
(thx Karanbir Toor, #37) - New
defcc
macro for when you only need React component, not the whole Rum state - [ BREAKING ] Component inner state (
:rum/state
) was moved fromprops
tostate
. It doesn’t change a thing if you were using Rum API only, but might break something if you were relaying on internal details - Deprecated
rum/with-props
macro, userum/with-key
orrum/with-ref
fns instead
- Allow components to refer to themselves (thx Kevin Lynagh, #30)
- Support for multi-arity render fns (#23)
- Added
local
mixin
- Fixed argument destructuring in defc macro (#22)
will-update
anddid-update
lifecycle methods added (thx Andrey Vasenin, #18)
- Components defined via
defc/defcs
will havedisplayName
defined (thx Ivan Dubrov, #16) - Not referencing
requestAnimationFrame
when used in headless environment (thx @whodidthis, #14)
- Compatibility with clojurescript 0.0-2758, macros included automatically when
(:require rum)
- Updated deps to clojurescript 0.0-2727, react 0.12.2-5 and sablono 0.3.1
- [ BREAKING ] New syntax for mixins:
(defc name < mixin1 mixin2 [args] body...)
- New
defcs
macro that adds additional first argument to render function:state
- Ability to specify
key
andref
to rum components viawith-props
- Fixed a bug when render-loop tried to
.forceUpdate
unmounted elements - Fixed a cursor leak bug in
reactive
mixin - Removed
:should-update
fromreactive
, it now will be re-rendered if re-created by top-level element - Combine
reactive
withstatic
to avoid re-rendering if component is being recreated with the same args