awstools: Fixed some bugs with the item view UI model

- The item view model is now being updated when the item itself is being updated
- Fixed a NPE when the item view model receives a nil item
This commit is contained in:
Leon Mika 2022-07-18 08:04:03 +10:00
parent 0f0bf70d01
commit cc7ead496f
4 changed files with 8 additions and 8 deletions

View file

@ -197,13 +197,13 @@ func (m *Model) selectedItem() (itemTableRow, bool) {
func (m *Model) postSelectedItemChanged() tea.Msg {
item, ok := m.selectedItem()
if !ok {
return nil
return dynamoitemview.NewItemSelected{ResultSet: item.resultSet, Item: nil}
}
return dynamoitemview.NewItemSelected{ResultSet: item.resultSet, Item: item.item}
}
func (m *Model) Refresh() {
func (m *Model) Refresh() tea.Cmd {
m.table.SetRows(m.rows)
return m.postSelectedItemChanged
}