-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Environment
playground
Reproduction
Describe the bug
pinia-orm/packages/pinia-orm/src/model/Model.ts
Lines 123 to 127 in 17d5f20
| /** | |
| * Original model data. | |
| */ | |
| protected static original: Record<string, any> = {} | |
Current Behavior
The original static property in the Model class stores original states using only the model's ID as the key, causing different model types to overwrite each other's original states when they share the same ID.
Expected Behavior
Models of different types should maintain separate original states even when they share the same ID values. The $getOriginal() method should return the correct original state for each model type independently.
Proposed Solution
Namespace the original states by model entity.
Additional context
I suppose pinia-orm doesn't require the model instances primary keys to be unique across the whole DB, just each Model. Hopefully I didn't miss it... Thanks.
Logs
No response