isar / isar/hive

TypeId is not consistent and how to safely remove adapter

Open
#1,275 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

In our previous app version we registered adapter with `typeId = 132`. In the new version we completely remove that adapter but we are facing an issue when the user updates the app with the error message `Cannot read, unknown typeId: 132. `. To fix that we `ignore` that typeId because **there is no function to remove registered adapter**. But the new issue comes, if we ignore that typeId we get the error message `HiveError: Cannot read, unknown typeId: 132. Did you forget to register an adapter?` and when checking the log is directed to this adapter.

![image](https://github.com/isar/hive/assets/1531684/80cd71ce-3ca1-40f0-887b-f3a7fd6a13c1)

if you see that typeId is `131` but why Hive detect that adapter as `132`

The steps to replicate that issue:

1. Create an adapter with typeId = 132 called AdapterA
2. Create an adapter with typeId = 131 called AdapterB
3. Install the app and use that adapter
4. Remove the AdapterA
5. Ignore the typeId 132
6. Run the project

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the six adapter registration, removal, and ignore steps described in the issue, then trace the adapter registration and ignored-type handling involved in the reported error. Done means the typeId remains consistent and updating an app after removing AdapterA no longer produces a misleading unknown-adapter error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.