From 5c0cf8a22a04fae0fc6700a01007f10e833bc2cf Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Tue, 14 Jul 2026 00:07:01 +0530 Subject: feat: caching and displaying the login form The login/signin form is fetched from the server everytime sign in is clicked. This on top of the fact that the server is already notoriously slow makes the time for the login form to appear quite long. This fixes it by caching the response html of the login form the first time and then reusing it in successive login attempts. --- src/scripts/common/login/form-caching.ts | 22 ++++++++++++++++++++++ src/scripts/common/login/index.ts | 1 - 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/scripts/common/login/form-caching.ts delete mode 100644 src/scripts/common/login/index.ts (limited to 'src/scripts/common/login') diff --git a/src/scripts/common/login/form-caching.ts b/src/scripts/common/login/form-caching.ts new file mode 100644 index 0000000..bde6442 --- /dev/null +++ b/src/scripts/common/login/form-caching.ts @@ -0,0 +1,22 @@ +import { addPostListener, addPostResponder, JQueryAjaxResponse } from "@/shared/intercept-jquery-ajax"; + +let loginAreaHTML: string | null = null; + +addPostResponder( + "viewLoginAreaAction", + function(_args): JQueryAjaxResponse | undefined | null { + return loginAreaHTML + ? { + data: loginAreaHTML + } + : null; + } +); + +addPostListener( + "viewLoginAreaAction", + function(_args, result): void { + loginAreaHTML = result.data?.toString() ?? ""; + }, + false +); diff --git a/src/scripts/common/login/index.ts b/src/scripts/common/login/index.ts deleted file mode 100644 index 95b9c5b..0000000 --- a/src/scripts/common/login/index.ts +++ /dev/null @@ -1 +0,0 @@ -import "@/scripts/common/login/captcha"; -- cgit v1.2.3