Skip to content

fix(history): avoid duplicate history IDs in persistence#1620

Open
AyushCoder9 wants to merge 1 commit into
foss42:mainfrom
AyushCoder9:fix/history-ids-dedup
Open

fix(history): avoid duplicate history IDs in persistence#1620
AyushCoder9 wants to merge 1 commit into
foss42:mainfrom
AyushCoder9:fix/history-ids-dedup

Conversation

@AyushCoder9
Copy link
Copy Markdown
Contributor

PR Description

This PR fixes duplicate historyIds persistence in HistoryMetaStateNotifier.addHistoryRequest.

Previously, the provider rebuilt state with the new id and then appended the same id again while writing historyIds, which could introduce duplicates in storage. This change persists historyIds directly from the current state keys so each history id is stored exactly once.

Also added a regression test:

  • test/providers/history_providers_test.dart
    • verifies that adding a history request persists a unique history id list.

Related Issues

  • Closes #

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch (run flutter upgrade and verify)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

We encourage you to add relevant test cases.

  • Yes
  • No, and this is why: please replace this line with details on why tests have not been included

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

Ensure history IDs are persisted without duplicates when adding a history request, and add a regression test to lock the behavior.

Made-with: Cursor
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.

1 participant