-
Basically, I am wondering how reusable are the types generated by drizzle objects. I am trying to return an array of regular objects, one key of which would be a drizzle object. I use a regular field (not the drizzle field) on the query and it seems to work ok as long as I only have a single element in my array. More than one throws an error from drizzle saying the model can't be found. Am I stretching the plugin too far ? From what I gather drizzle objects are queried from the db when returning them even if the root payload contains the required fields, which must be because of nested relations' abilities, it's very nice how everything is a single query. But somehow it cannot be performed multiple times, or as a common query, somehow losing the reference to the model ? I hope it makes sense. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
They should generally be re-usable, and shouldn't result in errors. The issues you will run into would be more likely related to performance/inefficiency. You are likely hitting some kind of a bug. Can you share more details or a reproduction of the issue? |
Beta Was this translation helpful? Give feedback.
-
ok, @hayes, found the bug. I think this line: should read : |
Beta Was this translation helpful? Give feedback.
-
And a PR #1343 |
Beta Was this translation helpful? Give feedback.
ok, @hayes, found the bug. I think this line:
pothos/packages/plugin-drizzle/src/model-loader.ts
Line 181 in 8794a12
should read :
[...entry.models.keys()].map((model) => this.sqlForModel(model))