fix(xo-web/audit): ref not correctly forwarded (#5106)

Introduced by 9f29a047a7

The high level component (audit UI) need to call a `SortedTable` method. The only way to do it is to have access to its ref.

All components between the high level component and the `SortedTable` should forward this ref. Unfortunately, the commit  9f29a047a7 decorate the `StortedTable` with `withRouter` without forwarding its ref which breaks the audit check integrity feedback.
This commit is contained in:
badrAZ
2020-06-29 15:44:33 +02:00
committed by GitHub
parent 41fb06187b
commit e3223b6124
3 changed files with 10 additions and 2 deletions

View File

@@ -11,6 +11,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Audit] Fix integrity check feedback not displayed (PR [#5106](https://github.com/vatesfr/xen-orchestra/pull/5106))
### Packages to release
> Packages will be released in the order they are here, therefore, they should
@@ -27,3 +29,5 @@
> - major: if the change breaks compatibility
>
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- xo-web minor

View File

@@ -1001,4 +1001,5 @@ class SortedTable extends Component {
}
}
export default withRouter(SortedTable)
// withRouter is needed to trigger a render on filtering/sorting items
export default withRouter(SortedTable, { withRef: true })

View File

@@ -287,7 +287,10 @@ export default decorate([
this.state._records = await fetchAuditRecords()
},
handleRef(_, ref) {
this.state.goTo = get(() => ref.goTo.bind(ref))
if (ref !== null) {
const component = ref.getWrappedInstance()
this.state.goTo = component.goTo.bind(component)
}
},
handleCheck(_, oldest, newest, error) {
const { state } = this