Replies: 4 comments
|
Hi @jcmourey, if you would like to fix this we would happily merge a PR. But we don't really consider this an issue so I am going to convert to a discussion. One approach would be to explicitly invoke |
|
Or maybe the seedSampleData Toolbar button should be only available if the database is empty. That way, no need to clutter each #Preview with a call to seedSampleData(). It could still be called from appDatabase() in non .live mode. What we lose is the ability to preview the Seed Sample Data toolbar button, but that could also be reintroduced with a single #Preview specially designed for that that would clear the data. I would be happy to propose a PR if that approach interests you. |
|
I just figured out why. It's because even though the data has been seeded, 🟣 Sharing/Reference.swift:263: Caught error: SQLite error 1: no such table: sqlitedata_icloud_metadata - while executing |

Uh oh!
There was an error while loading. Please reload this page.
Description
seedSampleData() is called from appDatabase() when in preview mode.
Also, in preview mode: seedSampleData is called from the Seed Data Toolbar button
This causes SQLite to fail from attempting to add duplicate data.
Checklist
mainbranch of this package.Expected behavior
Not really a big deal, but since it is a demo project that should probably as clean as possible, seedSampleData should probably get called from one or the other place, not both.
Actual behavior
🟣 Reminders/RemindersLists.swift:146: Caught error: SQLite error 19: UNIQUE constraint failed: tags.title - while executing
INSERT INTO "tags" ("title") VALUES (?), (?), (?), (?), (?), (?), (?)Reproducing project
No response
SQLiteData version information
No response
Sharing version information
No response
GRDB version information
No response
Destination operating system
No response
Xcode version information
No response
Swift Compiler version information
All reactions