~mariusor/motley

fcc05b8e203d4b2bca274e584992219b4c14e5bb — Marius Orcsik 4 months ago cb1e316
Fix showing errors when unable to convert IRIs to Object when displaying item model
2 files changed, 8 insertions(+), 5 deletions(-)

M item_model.go
M object_model.go
M item_model.go => item_model.go +5 -5
@@ 281,11 281,11 @@ func (i itemModel) updateAsModel(msg tea.Msg) (itemModel, tea.Cmd) {
	case nodeUpdateMsg:
		if mm.n != nil {
			i.item = mm.n.Item
			ob := newObjectModel()
			err := vocab.OnObject(i.item, ob.updateObject)
			if err != nil {
				cmds = append(cmds, errCmd(err))
			} else {
			if !(vocab.IsIRI(i.item) || vocab.IsItemCollection(i.item)) {
				ob := newObjectModel()
				if err := vocab.OnObject(i.item, ob.updateObject); err != nil {
					cmds = append(cmds, errCmd(err))
				}
				i.model = ob
			}
		}

M object_model.go => object_model.go +3 -0
@@ 57,6 57,9 @@ var binContentTypes = vocab.ActivityVocabularyTypes{
}

func (o ObjectModel) View() string {
	if o.ID == "" {
		return ""
	}
	pieces := make([]string, 0)

	// TODO(marius): move this to initialization, and move the setting of the nat values into the Update()