Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Create a store with the specified name UniqueViolationException #175

Open
Errechydy opened this issue Dec 28, 2024 · 2 comments · May be fixed by #156
Open

[BUG] Create a store with the specified name UniqueViolationException #175

Errechydy opened this issue Dec 28, 2024 · 2 comments · May be fixed by #156
Labels
bug This issue reports broken functionality or another error

Comments

@Errechydy
Copy link

Errechydy commented Dec 28, 2024

What is the bug?

The create method says "Does nothing if the store already exists." but it doesn't.
Putting await FMTCStore('mapStore').manage.create(); in the main method which means executed each time the app stared will trigger UniqueViolationException, the first time everything will work find because the store name hasn't been created yet, but when you refresh the app the following exception occurs.
UniqueViolationException (ObjectBoxException: object put failed: Unique constraint for ObjectBoxStore.name would be violated by putting object with ID 2 because same property value already exists in object with ID 1)

How can we reproduce it?

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Object? initErr;
  try {
    await FMTCObjectBoxBackend().initialise();
   await FMTCStore('mapStore').manage.create();
  } catch (err) {
    initErr = err;
    print("Error initialising FMTC: $err");
  }
// .......
  }

Do you have a potential solution?

No

Platforms

macOS 15.1

Severity

Fatal: Causes the application to crash

@Errechydy Errechydy added bug This issue reports broken functionality or another error needs verification This needs to be verified/tested before fixes (or not) can be made labels Dec 28, 2024
@JaffaKetchup
Copy link
Owner

I believe I have fixed this bug for v10 already. For the time being, please check if the store is ready first.

@JaffaKetchup JaffaKetchup removed the needs verification This needs to be verified/tested before fixes (or not) can be made label Dec 29, 2024
@JaffaKetchup JaffaKetchup linked a pull request Dec 29, 2024 that will close this issue
@Errechydy
Copy link
Author

Ok Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants