From f31ae09c2a1cc2351bb7f8179b1e946bba750ff0 Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Mon, 22 May 2023 12:46:31 -0500 Subject: [PATCH 1/3] Add generated idempotencyKey to automatic transaction alerts Closes T-977 --- src/examples/basic/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/examples/basic/index.ts b/src/examples/basic/index.ts index 5e18f22..d69bc0d 100644 --- a/src/examples/basic/index.ts +++ b/src/examples/basic/index.ts @@ -260,6 +260,11 @@ const prod = new Interval({ backgroundable: true, handler: async () => { const first = await io.input.text('First input') + await ctx.loading.start({ + label: 'Thinking...', + description: 'This will take 5 seconds, feel free to navigate away.', + }) + await sleep(5_000) const second = await io.input.text('Second input') return { first, second } From 75ec7ac48808a50084f4880c09c705a5e7b15703 Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Tue, 23 May 2023 13:36:49 -0500 Subject: [PATCH 2/3] Improve in-app action for connected hosts, enable force disconnects --- package.json | 2 +- src/classes/IntervalClient.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 31ab213..6b1fe12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@interval/sdk", - "version": "1.3.0", + "version": "1.3.1-dev", "description": "The frontendless framework for high growth companies. Interval automatically generates apps by inlining the UI in your backend code. It's a faster and more maintainable way to build internal tools, rapid prototypes, and more.", "homepage": "https://interval.com", "repository": { diff --git a/src/classes/IntervalClient.ts b/src/classes/IntervalClient.ts index c2b37b8..7c742a3 100644 --- a/src/classes/IntervalClient.ts +++ b/src/classes/IntervalClient.ts @@ -786,7 +786,8 @@ export default class IntervalClient { this.#resendPendingPageLayouts() }) .catch(err => { - this.#logger.debug('Failed resending saved calls', err) + this.#logger.debug('Failed reestablishing connection', err) + this.#isConnected = false }) this.#log.prod( From 04db0924641f1feb729f9fff14ffeb78b625e20a Mon Sep 17 00:00:00 2001 From: Jacob Mischka Date: Wed, 24 May 2023 14:43:58 -0500 Subject: [PATCH 3/3] Catch errors in initializeHost on handleActionsChange --- src/classes/IntervalClient.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/classes/IntervalClient.ts b/src/classes/IntervalClient.ts index 7c742a3..af5635f 100644 --- a/src/classes/IntervalClient.ts +++ b/src/classes/IntervalClient.ts @@ -337,8 +337,13 @@ export default class IntervalClient { if (this.#isInitialized && !this.#reinitializeTimeout) { this.#reinitializeTimeout = setTimeout(async () => { - await this.#initializeHost() - this.#reinitializeTimeout = null + try { + await this.#initializeHost() + } catch (err) { + this.#logger.error('Failed to reinitialize on routes change', err) + } finally { + this.#reinitializeTimeout = null + } }, this.#reinitializeBatchTimeoutMs) } }