Allow null TableRow sidebars
Summary: Makes the API a bit easier to use. Don't have to build an empty sidebar if you don't want one. Reviewed By: passy Differential Revision: D15064205 fbshipit-source-id: bd31c1aa97fd6d1c93717c10b268f49e44eb1299
This commit is contained in:
committed by
Facebook Github Bot
parent
4049720759
commit
f00ff72211
@@ -92,7 +92,7 @@ public abstract class TableRow {
|
||||
columnsObject.put("id", id);
|
||||
return new FlipperObject.Builder()
|
||||
.put("columns", columnsObject.build())
|
||||
.put("sidebar", sidebar.serialize())
|
||||
.put("sidebar", sidebar != null ? sidebar.serialize() : null)
|
||||
.put("id", id)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ function renderToolbar(section: ToolbarSection) {
|
||||
|
||||
function renderSidebarForRow(rowData: RowData): Node {
|
||||
if (!rowData.sidebar) {
|
||||
throw new Error('renderSidebar used with missing rowData.sidebar');
|
||||
return null;
|
||||
}
|
||||
if (!Array.isArray(rowData.sidebar)) {
|
||||
throw new Error('typeof rowData.sidebar is not array as expected: ');
|
||||
|
||||
Reference in New Issue
Block a user