-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
state: add trainingStore,modelStore. update: userStore #138
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Let's get on a call later cos I don't understand what you are saying.
…On Sat, Nov 11, 2023, 9:58 PM Hiro ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/state/modelStore.ts
<#138 (comment)>
:
> @@ -0,0 +1,74 @@
+import { create } from 'zustand'
+import { devtools, persist } from 'zustand/middleware'
+import { upsert_user } from ***@***.***/explore/upsert_user'
+import { Model, TrainingRequest } from ***@***.***/client'
+
+type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>
+type ITrainRequest = Omit<Omit<TrainingRequest, 'createdAt'>, 'updatedAt'>
+
+type Store = {
+ model: IModel | null
type Store = {
user: IUser | null
init: (user: IUser) => void
setUser: (user: Partial<IUser>) => void
}
refer the store above its maintaining user state and keeping it in sync
with "user" collection in DB
Similarily for every collection in mongoDB, there should be a store.
It should be like: the stores are our primariy DB and the changes are
replicated to mongoDB
------------------------------
In src/state/modelStore.ts
<#138 (comment)>
:
> @@ -0,0 +1,74 @@
+import { create } from 'zustand'
+import { devtools, persist } from 'zustand/middleware'
+import { upsert_user } from ***@***.***/explore/upsert_user'
+import { Model, TrainingRequest } from ***@***.***/client'
+
+type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>
+type ITrainRequest = Omit<Omit<TrainingRequest, 'createdAt'>, 'updatedAt'>
+
+type Store = {
+ model: IModel | null
so there needs to be separate *trainRequest* Store
------------------------------
In src/state/modelStore.ts
<#138 (comment)>
:
> @@ -0,0 +1,74 @@
+import { create } from 'zustand'
+import { devtools, persist } from 'zustand/middleware'
+import { upsert_user } from ***@***.***/explore/upsert_user'
+import { Model, TrainingRequest } from ***@***.***/client'
+
+type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>
+type ITrainRequest = Omit<Omit<TrainingRequest, 'createdAt'>, 'updatedAt'>
+
+type Store = {
+ model: IModel | null
for ModelStore: on init: it should get all models of userId from DB.
Don't use : models: IModel[] | null
It becomes harder to access. Use an object : {modelID: model}
Good job on creating: model: IModel | null to maintain the state of
DB-unsynced model. It does raise concerns if the user opens different tabs
and tries to create models in new tabs.
------------------------------
In src/state/modelStore.ts
<#138 (comment)>
:
> @@ -0,0 +1,74 @@
+import { create } from 'zustand'
+import { devtools, persist } from 'zustand/middleware'
+import { upsert_user } from ***@***.***/explore/upsert_user'
+import { Model, TrainingRequest } from ***@***.***/client'
+
+type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>
+type ITrainRequest = Omit<Omit<TrainingRequest, 'createdAt'>, 'updatedAt'>
+
+type Store = {
+ model: IModel | null
but that's alright, we can restrict user-usage to just one-tab I guess?
—
Reply to this email directly, view it on GitHub
<#138 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHKFVMLGRF2CFW4OT4RFTMTYD7RFXAVCNFSM6AAAAAA7HFGUT2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMRWGEZDINJQGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Signed-off-by: Nasfame <[email protected]>
by ci
Signed-off-by: Nasfame <[email protected]>
Signed-off-by: Nasfame <[email protected]>
by ci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Checklist
To be reviewed by: @Nasfame @techyNonso