You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Environment
playground
Reproduction
playground link
Describe the bug
pinia-orm/packages/pinia-orm/src/model/Model.ts
Lines 123 to 127 in 17d5f20
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
The text was updated successfully, but these errors were encountered: