Migrating to 1.2
What changed in the callback contract, and what you need to do
Existing dashboards keep working. Every renamed hook still accepts its old name, and handlers written in the older positional or this-based styles still run. Each deprecated key logs one warning naming its replacement, so the console tells you what to change.
Two behaviours did change, and both are covered below.
Renamed hooks
onGetValue
value
onLoop
onRender
onAdd
onMount
onRemove
onBeforeRemove
// Before
Status: { onGetValue: function (field) { return field.data.toUpperCase(); } }
// After
Status: { value: ({ value }) => value.toUpperCase() }One context object
Every callback now receives a single context object. See Callbacks.
Status: {
value: ({ value, record }) => record.Gender === 'Female' ? value.toUpperCase() : value,
visibility: ({ record }) => record.Status ? 'show' : 'hide',
onClick: ({ record, event }) => { event.stopPropagation(); open(record.Id); }
}value
The field's own value. Fields only.
record
The whole row. The same on every component.
component
The Field, Action or Record itself.
el
The rendered DOM node.
dashboard
The Dashboard instance.
event
The DOM event. onClick only.
Breaking: a field's onClick
A field's second argument used to be the field's value, despite being named record in the old examples. It is now the row, on every component.
If you relied on that argument being the value, read value from the context.
Breaking: onRemove
onRemove received a DashboardEvent and you completed it to allow the removal. onBeforeRemove uses the return value instead.
Return false to cancel, a promise to defer, anything else to proceed:
Configs still using onRemove keep the old event behaviour, so nothing breaks until you rename it.
Fixed behaviours you may have worked around
New in 1.2
icon,class,styleandwidthmay be functions, joiningvalue,urlandvisibility.onMountfires as a component is added to its parent.A callback that throws is contained โ the default is used and the error is logged, instead of the render failing.
Suggested order
Upgrade and load your dashboard. Every deprecated key you use logs a warning naming its replacement.
Rename them.
Check any field
onClickthat used the second argument.Convert
onRemovetoonBeforeRemoveand return a boolean instead of completing an event.Move the rest to the destructured form as you touch them โ the old styles keep working.
Last updated