Releases: YMFE/qreact
Releases · YMFE/qreact
[email protected]
- 全面支持 React v16 新特性
- 重构
findDOMNode
,遇到注释节点返回null
- 支持 React 组件返回任何数据类型,如数组,字符串,数字,布尔,但对于
undefined
,null
,boolean
不会生成真实 DOM - 支持
componentDidCatch
钩子与整个错误边界的逻辑 - 支持
createPortal
- 分离出 Vndoe 模块,并且附带其节点关系属性(
return
,sibling
,child
),return
相当于之前的hostParent
,sibling
相当于之前的nextSibling
,child
相当于之前的firstChild
,
- 模仿 React v16,使用
stateNode
属性代替旧有的hostNode
与instance
。 React.Children
与flattenChildren
底层依赖的方法由flattenChildren
改为operateChildren
,让其更具通用性,flattenChildren
更名为fiberizeChildren
,产出一个带链表结构的数组。- 新的架构:元素虚拟 DOM 与组件虚拟 DOM 都有自己的更新对象,简化匹配算法
- 简化 Refs 模块
- 修复更新虚拟 DOM 时,
namespaceURI
丢失的 BUG componentDidUpdate
现在只有两个参数,lastProps
与lastState
- 优化
fiberizeChildren
的性能 - 修复受控组件在
textarea
,radio
的 BUG,将受控事件放到用户 � 事件后集中执行 - 添加焦点系统的支持(全局 focus, blur 事件提前监听,移除添加节点的
Refs.nodeOperate
开头) - 解决多次引入 React 时,事件系统的
option.async
有问题的 BUG - 简化
createPortal
的实现 - 支持 React v16.2 的
Fragment
语法糖 cloneElement
需要处理disposed
元素cloneElement
对于props
的虚拟 DOM 进行复制- 设置属性的时机提前
- 修复了一个移动端 scroll 事件的问题
[email protected]
- 修复了一个移动端 scroll 事件的问题
[email protected]
- 修复了一个移动端
click
事件不触发的问题
[email protected]
- 修复了一个在
diffChildren
过程中没有updater
的问题。 - 修复了一个 SVG 属性赋值的问题,这个问题曾导致值为数字 0 的属性被错误的赋值为空字符串。
- 修复了一个在
componentDidMount
和componentDidUpdate
中调用setState()
时重复渲染的问题。 - Server Side Render 中增加
componentWillMount
生命周期钩子。 - 移除 Server Side Render 中的
data-react-checksum
和data-reactroot
属性。 - Server Side Render 支持
renderToNodeStream()
和renderToStaticNodeStream()
。 - 改善事件回调错误捕捉,现在错误信息会提供 QReact 报错的位置。
- 修复一个
diffProps()
函数的错误,这个错误曾经导致props
没有更新。 - 修复一个 QReact 在 SSR 中的错误,QReact 中使用
XMLHTTPRequest
对象来判断浏览器版本,而在 node.js 中没有这个对象导致出错。 - 修改了
ReactDOMServer.js
的打包脚本,将babelHelpers
包含在打包文件中,以便支持低版本 node.js。 - 在根目录增加了
server.js
,以便支持react-dom/server
的引用。
[email protected]
- 修复组件返回 Immutable.js 实例时无法正确渲染的问题
- 修复 SVG 命名空间丢失的问题
- 增加组件事件回调函数中的错误捕捉
[email protected]
- 增加一个专门给 IE 使用的
ReduxIE
,使用qreact/lib/ReduxIE
引入 - 修改
property
方法,仅部分属性通过赋值空字符串来删除 - 其他一些性能优化
[email protected]
- 抽象出一个
Updater
类,用于封装组件实例上的所有私有数据 - 抽象出一个
instantiateComponente
用于同时实例化有状态与无状态组件,从此再没有mountStateless
,updateStateless
方法 - 修正 checkbox 点一下会触发两次
onChange
的 BUG - 添加
ReceiveComponent
检测机制,如果context
,props
一样,那么就不会执行receive
,render
,update
等钩子 - 修改检测空对象的逻辑
- 简化任务调度系统的逻辑
- 添加
userRef
来优化 ref 在cloneElement
中的创建及detachRef
的比较,修正flushUpdaters
中updater
对象的泄露问题(需要clearArray
一下) - 优化
diffChildren
的逻辑,防止出现parentNode
等于null
的情况(比如为文本节点取firstChild
) - 简化
ControlledComponent
与dispose
模块
[email protected]
- 修正 onChange 事件
- 重构 diffProps 模块的实现
- 支持组件的isMounted方法
- 添加beforeRender, beforePatch, afterPatch钩子
- 添加lib/ReactInputSelection.js
[email protected]
- 修正
onChange
事件 - 重构
diffProps
模块的实现 - 支持组件的
isMounted
方法 - 重构虚拟 DOM 树的实现,与官方 React 保持一致,即
props.children
现在是多种形态,延迟到 diff 时才创建用于比较的vchildren
- 修正 ref 机制,如果为字符串时,通过
createStringRef
方法将当前 ref,owner
传入,返回一个 curry 方法,在cloneElement
时createStringRef
创建的方法会再被整合到新 ref 方法的内部,确保旧的 owner 再次被更新 - 修正 getNs 方法的实现(原先是使用 hash 表进行穷举,但 svg 文档也有
a
,script
,style
元素,导致无法区分) - 用户在
componentDidUpdate
使用setState
是不当操作,导致进入死循环,改用定时器减缓调用频率,防止页面卡死(官方 React 也存在类似的机制)
[email protected]
- 简化
createClass
- 修正
flattenHooks
BUG:如果hooks
中只有一个函数,就不用再包一层 createElement
里不对children
进行处理,延迟到 diff 时才创建用于比较的vchildren
- 修正
disposeElement
BUG:如果存在dangerouslySetInnerHTML
的情况,需要清空元素内部,不走遍历子虚拟 DOM 的分支 - 修正
diffProps
, SVG 元素是区分大小写 如viewBox
preserveAspectRation
- 组件更新时,要检测
context
是否改变 - 增加事件对象的
persist
方法 - 修正
unstable_renderSubtreeIntoContainer
的回调this
指向问题 - 修正
unmountComponentAtNode
BUG:#text
改为#comment
- 修正
cloneElement
BUG ref
改为在createElement
里进行处理