Work auto-closes?

19 views
Skip to first unread message

Wouter Hendriks

unread,
Oct 11, 2024, 7:40:07 AM10/11/24
to General WebHare developers discussion
Got this code:

    console.log('ensureTag1 ISWORKOPEN', whdb.isWorkOpen());
    // get the tag ID from wvuaw.tags
    const tag = await whdb.db<WvuawDB>()
      .selectFrom("wvuaw.tags")
      .where("tag", "=", _tag)
      .select(["id"])
      .executeTakeFirst() as { id: number } | undefined;
    console.log('ensureTag2 ISWORKOPEN', whdb.isWorkOpen());

Output:

ensureTag1 ISWORKOPEN true
ensureTag2 ISWORKOPEN false

Somehow, the work is closed after the select? What could cause this?

Arnold Hendriks

unread,
Oct 11, 2024, 7:43:29 AM10/11/24
to General WebHare developers discussion, Wouter Hendriks
Something running between the start and completion of the select that closes the work or the context. 

There's n way to even guess without context - who/what is actually managing the transaction.
 

Wouter Hendriks

unread,
Oct 12, 2024, 8:18:02 AM10/12/24
to General WebHare developers discussion, Arnold Hendriks
Yeah, forgot an 'await' somewhere.

Tip: if you want your editor to warn you about forgetting awaits (which I forget pretty often :-)), use this rule:


Make sure to follow the https://typescript-eslint.io/getting-started/typed-linting/ instructions as well.

Arnold Hendriks

unread,
Nov 22, 2024, 11:05:48 AM11/22/24
to General WebHare developers discussion
On Saturday, October 12, 2024 at 2:18:02 PM UTC+2 Wouter Hendriks wrote:
Yeah, forgot an 'await' somewhere.

Tip: if you want your editor to warn you about forgetting awaits (which I forget pretty often :-)), use this rule:


Make sure to follow the https://typescript-eslint.io/getting-started/typed-linting/ instructions as well.

Enabling this has been on our wishlist for quite a while, but to enable it in wh validate required a bit of work as you need to integrate eslint and tsc a lot deeper ('parser services'). 

And the list of issues to fix once we enable this was no fun. Hats off to Rob for his horrible week :)

Arnold Hendriks

unread,
Dec 30, 2024, 4:11:38 PM12/30/24
to General WebHare developers discussion, Arnold Hendriks
8:02 PM UTC+2 Wouter Hendriks wrote:
Yeah, forgot an 'await' somewhere.

Tip: if you want your editor to warn you about forgetting awaits (which I forget pretty often :-)), use this rule:


Make sure to follow the https://typescript-eslint.io/getting-started/typed-linting/ instructions as well.

Enabling this has been on our wishlist for quite a while, but to enable it in wh validate required a bit of work as you need to integrate eslint and tsc a lot deeper ('parser services'). 


And we've had this for a few weeks now! Still only warnings and we might have to start recommending some specific coding patterns to help reduce the list
 
Reply all
Reply to author
Forward
0 new messages