@@ -110,10 +110,10 @@ void KVOAdapter::before(Transaction& sg)
110
110
m_invalidated.push_back (observer.info );
111
111
continue ;
112
112
}
113
- auto column_modifications = table. get_columns_modified (key );
114
- if (column_modifications ) {
115
- for (auto col : *column_modifications ) {
116
- observer.changes [col. value ].kind = BindingContext::ColumnInfo::Kind::Set;
113
+ auto tbl = sg. get_table (observer. table_key );
114
+ if (auto path_modifications = table. get_paths_modified (key) ) {
115
+ for (const StablePath& path : *path_modifications ) {
116
+ observer.changes [tbl-> get_column_key (path[ 0 ]) ].kind = BindingContext::ColumnInfo::Kind::Set;
117
117
}
118
118
}
119
119
}
@@ -123,7 +123,7 @@ void KVOAdapter::before(Transaction& sg)
123
123
// We may have pre-emptively marked the column as modified if the
124
124
// LinkList was selected but the actual changes made ended up being
125
125
// a no-op
126
- list.observer ->changes .erase (list.col_key . value );
126
+ list.observer ->changes .erase (list.col_key );
127
127
continue ;
128
128
}
129
129
// If the containing row was deleted then changes will be empty
@@ -132,7 +132,7 @@ void KVOAdapter::before(Transaction& sg)
132
132
continue ;
133
133
}
134
134
// otherwise the column should have been marked as modified
135
- auto it = list.observer ->changes .find (list.col_key . value );
135
+ auto it = list.observer ->changes .find (list.col_key );
136
136
REALM_ASSERT (it != list.observer ->changes .end ());
137
137
auto & builder = list.builder ;
138
138
auto & changes = it->second ;
@@ -364,15 +364,17 @@ class TransactLogObserver : public TransactLogValidationMixin {
364
364
return true ;
365
365
}
366
366
367
- bool select_collection (ColKey col , ObjKey obj, const StablePath& path)
367
+ bool select_collection (ColKey, ObjKey obj, const StablePath& path)
368
368
{
369
- modify_object (col, obj);
369
+ if (m_active_table) {
370
+ m_active_table->modifications_add (obj, path);
371
+ }
370
372
auto table = current_table ();
371
373
m_active_collection = nullptr ;
372
374
for (auto & c : m_info.collections ) {
373
375
if (c.table_key == table && c.obj_key == obj && c.path .is_prefix_of (path)) {
374
376
if (c.path .size () != path.size ()) {
375
- c.changes ->paths .insert (path[c.path .size ()]);
377
+ c.changes ->stable_indexes .insert (path[c.path .size ()]);
376
378
}
377
379
// If there are multiple exact matches for this collection we
378
380
// use the first and then propagate the data to the others later
@@ -463,8 +465,11 @@ class TransactLogObserver : public TransactLogValidationMixin {
463
465
464
466
bool modify_object (ColKey col, ObjKey key)
465
467
{
466
- if (m_active_table)
467
- m_active_table->modifications_add (key, col);
468
+ if (m_active_table) {
469
+ StablePath path;
470
+ path.push_back (StableIndex (col, 0 ));
471
+ m_active_table->modifications_add (key, path);
472
+ }
468
473
return true ;
469
474
}
470
475
0 commit comments