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

Model original state not isolated between different model types #1953

Open
petrmifek opened this issue Nov 15, 2024 · 0 comments · May be fixed by #1954
Open

Model original state not isolated between different model types #1953

petrmifek opened this issue Nov 15, 2024 · 0 comments · May be fixed by #1954

Comments

@petrmifek
Copy link

Environment

playground

Reproduction

playground link

Describe the bug

/**
* 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant