Closed amhed closed 2 years ago
Inspecting transpiled JS it looks like decorator metadata is being issued:
__decorate([
(0,decorators.field)('walletId'),
__metadata("design:type", String)
], WalletWMO.prototype, "walletId", void 0);
__decorate([
(0,decorators.field)('currencyCodeStr'),
__metadata("design:type", String)
], WalletWMO.prototype, "currencyCodeStr", void 0);
Update: I'm deploying this on a shared data layer for both react and react-native. The React-Native side executes flawlessly. Only the web side bombs :o
Aaaaand I had a different target for the web version. Set to ES2020 :)
@amhed Hi, I met the same issue - the _raw always empty. The web version you set is the version in babel config or ts config? Formerly my project use webpack, so everything is fine.But when I try to migrate to vite, on the dev environment, the _raw field in watermelondb is always empty.
@leejunhui I have the same problem. Just migrated to Vite + Typescript and the _raw fields are empty. Did you get it running in the end?
@leejunhui I have the same problem. Just migrated to Vite + Typescript and the _raw fields are empty. Did you get it running in the end?
sorry, I haven't sovled the problem.I think the truly cause is the lack of support of javascript decorator of esbuild~
Any solution to use this with Vite?
add ._raw in create function
database.write(async () => { const contact = await contactsCollection.create(contact => { contact._raw.contact_name = new_contact.contact_name; contact._raw.contact_phone = new_contact.contact_phone; }); });
@amhed Hi, I met the same issue - the _raw always empty. The web version you set is the version in babel config or ts config? Formerly my project use webpack, so everything is fine.But when I try to migrate to vite, on the dev environment, the _raw field in watermelondb is always empty.
@leejunhui did you ever figure this out?! I am running into exactly the same issue using vite and the nodejs sqlite adapter in Watermelon.
@kegesch @parsagholipour did you end up settling on a solution / workaround or figure out the problem? I also am using vite and TypeScript and running into the EXACT same issues.
@Alarees your solution does work (hard setting the _raw
properties) but in the Watermelon docs it explicitly says you should not do that. So I am wondering how this can be fixed (or a workaround) in a supported / recommend way by Watermelon. @radex can you provide some guidance here please? Thanks so much! You can see here a full explanation of my issue (similar to described above) and how I followed the docs with no success: https://github.com/Nozbe/WatermelonDB/issues/1826#issuecomment-2353292866
I'm running into an issue similar to these ones:
When using
create
the write operation succeeds into writing, but the object is always written with empty values. Inspecting the return object I can see that_raw
has all the fields defined by the schema, but they all have the default values instead.schema
Model
Code to insert
And yet, the underlying `_raw values are empty/default
Tsconfig has
BabelConfig has