Skip to content

Comments

Optimize DB operations and add migration for tab ordering#257

Merged
ZanderCowboy merged 4 commits into7-implement-draggable-retryfrom
copilot/sub-pr-252-again
Feb 9, 2026
Merged

Optimize DB operations and add migration for tab ordering#257
ZanderCowboy merged 4 commits into7-implement-draggable-retryfrom
copilot/sub-pr-252-again

Conversation

Copy link

Copilot AI commented Feb 9, 2026

Addresses performance issues and data migration concerns from PR #252 review feedback. Multiple tabs with order=0 cause non-deterministic UI ordering on existing installations. Repository methods perform N individual DB calls instead of bulk operations.

Database Performance

  • Bulk operations: Replace get()/put() loops with getAll()/putAll() in updateTabsOrder(), readEntries(), readTabs(), and getTab()
  • Reduces DB round-trips from O(N) to O(1) for large collections

Tab Order Migration

  • Detect duplicate order values on readTabs() and auto-migrate based on timestamp
  • Preserves original creation order for existing installations
  • Runs once transparently, no user action required
// Before: N individual reads
for (final id in entryIds) {
  final entry = await db.entrys.get(id);
}

// After: Single bulk read
final entries = await db.entrys.getAll(entryIds);

Error Handling

  • Reorder operations: Check persistence success and revert UI on failure
  • Delete operations: Only set isDeleted=true when repository confirms success
  • Prevents UI/DB state divergence

JSON Compatibility

  • Add @JsonKey(defaultValue: 0) to Tabs.order and TabsDTO.order
  • Handles import of older export files missing the order field

Minor Fixes

  • First tab now uses order=0 instead of order=1 (consistent 0-based indexing)
  • Simplified controller disposal check in ReusableForm using hasListeners

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 9, 2026 00:20
…ing improvements

Co-authored-by: ZanderCowboy <59666243+ZanderCowboy@users.noreply.github.com>
Co-authored-by: ZanderCowboy <59666243+ZanderCowboy@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • archives.flutterinstaller.com
    • Triggering command: /usr/bin/curl curl -fL REDACTED -o dart.zip (dns block)
  • dart.dev
    • Triggering command: /usr/bin/curl curl -L REDACTED -o /tmp/dart_sdk.zip (dns block)
  • https://storage.googleapis.com/flutter_infra_release/flutter/587c18f873b8ab57330422bce09047420d9c7f42/dart-sdk-linux-x64.zip
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED (http block)
    • Triggering command: /usr/bin/curl curl --retry 3 --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED (http block)
    • Triggering command: /usr/bin/curl curl -L -o dart-sdk-linux-x64.zip REDACTED --exclude-standard --others /opt/pipx_bin/bash (http block)
  • https://storage.googleapis.com/flutter_infra_release/flutter/587c18f873b8ab57330422bce09047420d9c7f42/engine_stamp.json
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --verbosity=error --snapshot=/tmp/flutter/bin/cache/flutter_tools.snapshot --snapshot-kind=app-jit --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json --no-enable-mirrors /tmp/flutter/packages/flutter_tools/bin/flutter_tools.dart --global /cache/dart-sdk---noprofile googleapis.com/flutter_infra_release/flutter/587c18f873b8ab57330422bce09047420d9c7f42/dart-sdk-linux-x64.zip --pr�� (http block)
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --verbosity=error --snapshot=/tmp/flutter/bin/cache/flutter_tools.snapshot --snapshot-kind=app-jit --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json --no-enable-mirrors /tmp/flutter/packages/flutter_tools/bin/flutter_tools.dart --global /home/REDACTED/wor/home/REDACTED/.pub-cache/_temp/dirVWUUED/coverage_REDACTED.sh bash _dar�� --version git /snap/bin/bash er.git pull.rebase /usr/bin/bash bash (http block)
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --verbosity=error --snapshot=/tmp/flutter/bin/cache/flutter_tools.snapshot --snapshot-kind=app-jit --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json --no-enable-mirrors /tmp/flutter/packages/flutter_tools/bin/flutter_tools.dart credential.helpe--norc (http block)
  • https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json /tmp/flutter/bin/cache/flutter_tools.snapshot pub get --help b-cache/_temp/dils bash e /melos&#34;},&#34;l&#34;:{&#34;v&#34;:&#34;6.3.3&#34;,&#34;e&#34;:{&#34;p&#34;:&#34;melos&#34;,&#34;e&#34;:&#34;melos&#34;},&#34;s&#34;:false,&#34;fp&#34;:false,&#34;p&#34;:&#34;/home/REDACTED/ amp /tmp/flutter/bin/cache bash _engine_version.sh ,&#34;g&#34;:{&#34;v&#34;:&#34;7.4.0bash bash /flutter _engine_version.get (http block)
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json /tmp/flutter/bin/cache/flutter_tools.snapshot pub get sh hlytics_add_uplobash r-desktop-embedd/tmp/flutter/bin/internal/update_engine_version.sh rFVQAYY bash n/me�� while kill -0 8965; do sleep 1; done; kill -9 9033 chmod tnet/tools/git ice/multichoice&#34;bash /bin/sh rgo/bin/bash mkdir (http block)
    • Triggering command: /tmp/flutter/bin/cache/dart-sdk/bin/dartvm /tmp/flutter/bin/cache/dart-sdk/bin/dartvm --resolved_executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --executable_name=/tmp/flutter/bin/cache/dart-sdk/bin/dart --packages=/tmp/flutter/packages/flutter_tools/.dart_tool/package_config.json /tmp/flutter/bin/cache/flutter_tools.snapshot doctor --verbose b-cache/bin/bash ice/multichoice&#34;bash bash p/bin/gzip bash /tmp�� 54; do sleep 1; done; kill -9 95OUTPUT /global_packages/melos&#34;},&#34;l&#34;:{&#34;v-d p/bin/bash rAFWPLV/test/colbash bash /home/REDACTED/.ca--noprofile bash (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json
    • Triggering command: /usr/bin/curl curl -sL REDACTED bin/dart acka�� n/melos.dart-3.10.9.snapshot bash /home/REDACTED/.cargo/bin/bash (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.3-stable.tar.xz
    • Triggering command: /usr/bin/curl curl -L -o flutter_stable.tar.xz REDACTED /usr/bin/head sh /usr/bin/git bootstrap head /usr/local/bin/b-q git _eng�� /cache bash /usr/local/.ghcup/bin/bash rFHBOHR/bin/analbash mkdir tnet/tools/bash unner/.pub-cachemelos:melos (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.9-stable.tar.xz
    • Triggering command: /usr/bin/wget wget -q REDACTED (http block)
    • Triggering command: /usr/bin/curl curl -fL -o flutter_linux_3.38.9-stable.tar.xz REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Implement draggable retry for entries Optimize DB operations and add migration for tab ordering Feb 9, 2026
Copilot AI requested a review from ZanderCowboy February 9, 2026 01:14
@ZanderCowboy ZanderCowboy marked this pull request as ready for review February 9, 2026 08:38
@ZanderCowboy ZanderCowboy merged commit 72c2b79 into 7-implement-draggable-retry Feb 9, 2026
2 checks passed
@ZanderCowboy ZanderCowboy deleted the copilot/sub-pr-252-again branch February 9, 2026 10:41
ZanderCowboy added a commit that referenced this pull request Feb 9, 2026
* feat: add changelog and changelog_entry model

* feat: create changelog_repository

* feat: add changelog_bloc

* chore: update FirebaseConfigKeys

* feat: update frontend and create ChangelogPage

* chore: update changelog.md in cursor commands

* docs: changelog

* chore: update firebase_service with a forceFetchAndActivate

* chore: update styling for changelog_page and add button to refresh

* docs: changelog

* test: changelog_bloc and changelog_repository

* chore: add tests to cursor commands

* backend: update entry and tab repository for reordering

* backend: update models for reordering and add TODOs

* chore: update TabsMapper

* chore: update HomeBloc with reordering events

* test: update details_bloc, home_bloc, product_bloc, search_bloc

* frontend: add Reordering capabilities

* chore: update tutorial_page and repo

* chore: update analysis_options

* docs: changelog

* chore: update changelog cursor command

* feat(ui): add gap3 and vertical4horizontal0 spacing constants

* feat(android): enable onBackInvokedCallback for predictive back gesture

* feat(details): add delete functionality to details bloc

* feat(details): update details page UI to support delete functionality

* feat(layout): implement cross-collection entry dragging in tab layouts

* feat(home): update collection tab and entry card for drag support

* refactor(edit): update edit pages for consistency

* refactor(add): update add widgets for consistency

* refactor(presentation): update various pages for consistency and spacing

* feat(android): update splash screen to match home page background color

- Add color resources for light (#697a91) and dark (#050a19) themes
- Update launch_background.xml files to use theme-aware splash_background color
- Splash screen now matches home page background in both light and dark modes

* feat(ios): update splash screen to match home page background color

- Add splash_background color asset with light and dark appearance variants
- Update LaunchScreen.storyboard to use theme-aware splash_background color
- Splash screen now matches home page background in both light and dark modes

* feat(web): update splash screen to match home page background color

- Update manifest.json background_color and theme_color to #697a91
- Update index.html body background color to match home page
- Splash screen now matches home page background color

* chore: add commit cursor command

* chore: update create-pr cursor command

* chore: update create-pr cursor command

* chore: create fix.md cursor command

* test: details_bloc

* feat: create code-review.agent for github

* test: data_exchange_service failing

* 7 Draggable Fix Tests (#262)

* test: data_exchange_service

* test: data_exchange_service whitespaces

* test: firebase_service

* chore: update test cursor command

* chore: update create-pr.md cursor command

* Optimize DB operations and add migration for tab ordering (#257)

* Initial plan

* refactor: address PR review feedback with performance and error handling improvements

Co-authored-by: ZanderCowboy <59666243+ZanderCowboy@users.noreply.github.com>

* Optimize DB operations and add migration for tab ordering

Co-authored-by: ZanderCowboy <59666243+ZanderCowboy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ZanderCowboy <59666243+ZanderCowboy@users.noreply.github.com>
Co-authored-by: Zander Kotze <zanderkotze99@gmail.com>

* chore: UI update

* docs: changelog

* chore: fix dependency injection issue

* chore: minor changes

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants