-
Notifications
You must be signed in to change notification settings - Fork 50
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
Streamline resource creation api #798
Labels
Comments
Some additional thoughts:
|
I just realised we need store to set the parent and a class so going the |
That way even the parent becomes optional - we could default to the |
Polleps
added a commit
that referenced
this issue
Jan 15, 2024
Polleps
added a commit
that referenced
this issue
Jan 15, 2024
joepio
pushed a commit
that referenced
this issue
Jan 15, 2024
joepio
pushed a commit
that referenced
this issue
Jan 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creating new resources with @tomic/lib is currently very unintuitive, to create a resource you need to "fetch" or "get" a resource but tell the store it is new. It also doesn't set any properties so you can't directly save it.
We should have a separate function to create new resources e.g.
store.newResource()
. Ideally this also takes a class(es) and parent because you have to set those on all resources anyway.Something like
Alternatively we could add an overload to the
Resource
constructor e.g.Maybe we can add a way to quickly set additional properties too
The text was updated successfully, but these errors were encountered: