Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions pkg/app/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,30 +771,29 @@ func (m nodeManager) encodeRawHTML(w *bytes.Buffer, depth int, v *raw) {

func canUpdateValue(v, new reflect.Value) bool {
switch v.Kind() {
case reflect.String,
reflect.Bool,
reflect.Int,
reflect.Int64,
reflect.Int32,
reflect.Int16,
reflect.Int8,
reflect.Uint,
reflect.Uint64,
reflect.Uint32,
reflect.Uint16,
reflect.Uint8,
reflect.Float64,
reflect.Float32:
return !v.Equal(new)

case reflect.String:
return v.String() != new.String()
case reflect.Bool:
return v.Bool() != new.Bool()
case reflect.Int, reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8:
return v.Int() != new.Int()
case reflect.Uint, reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8:
return v.Uint() != new.Uint()
case reflect.Float64, reflect.Float32:
return v.Float() != new.Float()
default:
switch v.Interface().(type) {
case time.Time:
return !v.Equal(new)

default:
return !reflect.DeepEqual(v.Interface(), new.Interface())
vInterface := v.Interface()
newInterface := new.Interface()

// Special handling for time.Time
if _, ok := vInterface.(time.Time); ok {
t1, _ := vInterface.(time.Time)
t2, _ := newInterface.(time.Time)
return !t1.Equal(t2)
}

// For other types, fall back to reflect.DeepEqual
return !reflect.DeepEqual(vInterface, newInterface)
}
}

Expand Down