improve sync logic

This commit is contained in:
Fabian Freund
2026-05-27 07:04:33 +02:00
parent c3d3f726b7
commit 4b74223a3f
2 changed files with 120 additions and 30 deletions
@@ -150,6 +150,35 @@ void main() {
},
);
test(
'tab-list sync resolves an unresolved engine parent after inserting the parent row',
() async {
await _insertTabs(db, const [
_TabFixture('child', source: TabSource.addedEvent),
]);
await db.tabDao.updateTabs(null, {
'child': _tabState('child', parentId: 'late-parent'),
});
final unresolvedChild = await db.tabDao
.getTabDataById('child')
.getSingleOrNull();
expect(unresolvedChild, isNotNull);
expect(unresolvedChild!.parentId, isNull);
expect(unresolvedChild.source, TabSource.addedEvent);
await db.tabDao.syncTabs(retainTabIds: const ['late-parent', 'child']);
final resolvedChild = await db.tabDao
.getTabDataById('child')
.getSingleOrNull();
expect(resolvedChild, isNotNull);
expect(resolvedChild!.parentId, 'late-parent');
expect(resolvedChild.source, TabSource.manual);
},
);
test(
'content-state sync ignores parent-only changes with unresolved parents',
() async {