-
Notifications
You must be signed in to change notification settings - Fork 283
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
A way to disable 'preventAwait' #748
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
9cb85e0
to
3494fd9
Compare
Hey 👋
I didn't get the necessity quite honestly. Can you elaborate on that? |
The code from original issue #693, and I'm not sure I can find better example.. Yeah it is not "often" but "rarely", sorry for overstating. |
There is a logical reason. People coming from knex and objection would make the mistake of awaiting queries without |
@koskimas I didn't denied it. I meant "programming logic error". Anyways, It was a light suggestion, never mind. |
I think it wouldn't hurt to add this. But remove the Edit: Or actually, will that cause infinite recursion? Does |
@koskimas Yes. That was the reason I have to delete |
…rn-off-prevent-await
…kysely-org#1085) * add reusable helpers recipe and implement missing expression features * force node 22.4.1 in CI because of an npm bug
* feat: add postgres range types (kysely-org#1086) * feat: support refresh naterialized view * fix tests by adding .materialized() to remove the matview * fix failing test * fix: References typo (kysely-org#1092) * chore: refresh-view-node.ts => refresh-materialized-view-node.ts * chore: export node in index.ts --------- Co-authored-by: Isak <[email protected]> Co-authored-by: Jonathan Wu <[email protected]>
preventAwait actually causes issues with anybody trying to return partially built queries from async functions. Not sure if the builders originally implemented the thenable protocol, but it's obvious it shouldn't be used as a means to execute the queries. It does mean that any return of queries or an attempt at query composition in async functions cannot work with preventAwait on the builders. |
I'm hitting this as well to use a I'm trying to create a function that enhances the query ( This function looks like:
this function needs to be in a handler I call
but this fails with:
I understand the rationale behind the |
I'll remove |
And objection and a bunch of other ORMs. That's a big part of Kysely's users. What's your point? |
Yet another issue about this. Let's just remove @wirekang If you have time and interest, could you remove |
@koskimas Just removed all preventAwait related lines from v0.28 branch. Is it what you meant? (This PR is for master branch). |
Related kysely-org#748
New PR for |
Although @koskimas closed #693 as 'wontfix', I'm suggesting a way to disable the behavior of preventAwait, with a small footprint. We often returning non-Promise value in async function or then() chains. It would be great if Kysely have an option for those situation, for people who aren't Knex-newbie or know how to execute query.
The name 'allowNoopAwait' is a little bit temporary, it can be renamed as 'allowAwait', 'ignoreAwait', 'disablePreventAwait', 'iKnowHowToExecute' or something you suggest.