Refactor deep-linking, in the process extracted out OperationsTag (#4349)
* add configsActions.loaded hook * add OperationTag to hold Operations * fix test for operations * refactor deep-linking plugin
This commit is contained in:
26
src/core/plugins/deep-linking/operation-wrapper.jsx
Normal file
26
src/core/plugins/deep-linking/operation-wrapper.jsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from "react"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
|
||||
const Wrapper = (Ori, system) => class OperationWrapper extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
operation: ImPropTypes.map.isRequired,
|
||||
}
|
||||
|
||||
onLoad = (ref) => {
|
||||
const { operation } = this.props
|
||||
const { tag, operationId } = operation.toObject()
|
||||
const isShownKey = ["operations", tag, operationId]
|
||||
system.layoutActions.readyToScroll(isShownKey, ref)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span ref={this.onLoad}>
|
||||
<Ori {...this.props} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Wrapper
|
||||
Reference in New Issue
Block a user