From 5deeef44b898550a007ce7a42f034a7c561dfa24 Mon Sep 17 00:00:00 2001 From: Anthony Chan Date: Fri, 13 Dec 2024 10:13:02 +0800 Subject: [PATCH 1/5] use global variable --- src/context.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/context.ts b/src/context.ts index cbd3727..a8938ca 100644 --- a/src/context.ts +++ b/src/context.ts @@ -3,6 +3,8 @@ import React, { useContext } from 'react' import { noop } from './util' +let requests: string[] = [] + interface FreezeRequestsContextValue { freezeRequests: string[] setFreezeRequests: React.Dispatch> @@ -19,10 +21,12 @@ export const useFreezeRequestsContext = () => { return { freezeRequests, request: (sourceId: string) => { - setFreezeRequests([...freezeRequests, sourceId]) + requests = [...requests, sourceId] + setFreezeRequests(requests) }, revoke: (sourceId: string) => { - setFreezeRequests(freezeRequests.filter((x) => x !== sourceId)) + requests = requests.filter((x) => x !== sourceId) + setFreezeRequests(requests) }, } } From 7a8a5a1a87fae55892ee75d727e83d23c13566b5 Mon Sep 17 00:00:00 2001 From: Anthony Chan Date: Fri, 13 Dec 2024 11:47:10 +0800 Subject: [PATCH 2/5] disable src --- .npmignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index 0df89aa..7d87ae0 100644 --- a/.npmignore +++ b/.npmignore @@ -2,6 +2,6 @@ .eslintrc.js .eslintignore prettier.config.js -src +# src tsconfig.json dist/tsconfig.tsbuildinfo \ No newline at end of file From aebb9f5d9ed24dc09b0714125ec9fb672435f975 Mon Sep 17 00:00:00 2001 From: Anthony Chan Date: Fri, 13 Dec 2024 13:53:44 +0800 Subject: [PATCH 3/5] update version --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 303aff8..e214514 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextjs-router-events", - "version": "0.0.3", + "version": "0.0.4", "description": "A router events alternative for Next.js 13+ with app directory with the ability to prevent user navigation.", "author": "run4w4y ", "main": "dist/index.js", @@ -8,8 +8,6 @@ "scripts": { "lint": "eslint --ignore-path .gitignore .", "lint:fix": "npm run lint -- --fix", - "release": "standard-version --no-verify", - "build": "rm -rf dist && tsc" }, "repository": { "type": "git", From 5ad1a4c6ef3458fa68425f9c4963a4126ba2aa05 Mon Sep 17 00:00:00 2001 From: Anthony Chan Date: Fri, 13 Dec 2024 13:54:43 +0800 Subject: [PATCH 4/5] fix format --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e214514..1ea8267 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "types": "dist/index.d.ts", "scripts": { "lint": "eslint --ignore-path .gitignore .", - "lint:fix": "npm run lint -- --fix", + "lint:fix": "npm run lint -- --fix" }, "repository": { "type": "git", From 53993e12a0ee7bd68aeaa3f917f264ee42e36d44 Mon Sep 17 00:00:00 2001 From: Anthony Chan Date: Fri, 13 Dec 2024 14:05:24 +0800 Subject: [PATCH 5/5] revert unnecessary changes --- .npmignore | 2 +- package.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index 7d87ae0..0df89aa 100644 --- a/.npmignore +++ b/.npmignore @@ -2,6 +2,6 @@ .eslintrc.js .eslintignore prettier.config.js -# src +src tsconfig.json dist/tsconfig.tsbuildinfo \ No newline at end of file diff --git a/package.json b/package.json index 1ea8267..8a194f3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "types": "dist/index.d.ts", "scripts": { "lint": "eslint --ignore-path .gitignore .", - "lint:fix": "npm run lint -- --fix" + "lint:fix": "npm run lint -- --fix", + "release": "standard-version --no-verify", + "build": "rm -rf dist && tsc" }, "repository": { "type": "git",