From b3067a2d71d6363f1a6063117988fa9184dad54a Mon Sep 17 00:00:00 2001 From: Arjun <14841132+arjunvegda@users.noreply.github.com> Date: Thu, 2 Mar 2023 21:22:31 -0500 Subject: [PATCH] feat: mark internal atoms as private --- package.json | 2 +- src/common.ts | 12 +++++++++++- src/environmentAtom.ts | 4 ++++ yarn.lock | 8 ++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a471395..66331c8 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "html-webpack-plugin": "^5.5.0", "jest": "^29.4.1", "jest-environment-jsdom": "^29.4.1", - "jotai": "^2.0.0", + "jotai": "^2.0.3", "microbundle": "^0.15.1", "npm-run-all": "^4.1.5", "prettier": "^2.8.3", diff --git a/src/common.ts b/src/common.ts index 4271307..0a822b0 100644 --- a/src/common.ts +++ b/src/common.ts @@ -14,7 +14,9 @@ export const createAtom = ( ) => ActionResult, ) => { const refreshAtom = atom(0); - + if (process.env.NODE_ENV !== 'production') { + refreshAtom.debugPrivate = true; + } const observableAtom = atom((get) => { get(refreshAtom); const args = getArgs(get); @@ -23,12 +25,20 @@ export const createAtom = ( return observable; }); + if (process.env.NODE_ENV !== 'production') { + observableAtom.debugPrivate = true; + } + const baseDataAtom = atom((get) => { const observable = get(observableAtom); const resultAtom = atomWithObservable(() => observable); return resultAtom; }); + if (process.env.NODE_ENV !== 'production') { + baseDataAtom.debugPrivate = true; + } + const dataAtom = atom( (get) => { const resultAtom = get(baseDataAtom); diff --git a/src/environmentAtom.ts b/src/environmentAtom.ts index 3b282f6..baae80c 100644 --- a/src/environmentAtom.ts +++ b/src/environmentAtom.ts @@ -28,3 +28,7 @@ const defaultEnvironment = new Environment({ }); export const environmentAtom = atom(defaultEnvironment); + +if (process.env.NODE_ENV !== 'production') { + environmentAtom.debugPrivate = true; +} diff --git a/yarn.lock b/yarn.lock index cee669b..9e63ad6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5162,10 +5162,10 @@ jest@^29.4.1: import-local "^3.0.2" jest-cli "^29.4.1" -jotai@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/jotai/-/jotai-2.0.0.tgz#3938ad0166130417811bb57ec2de8abeb24bd948" - integrity sha512-04G0CRZQgp3xrFAezd6X14psZ2TRGekHeYMBcbDJ/BR8ZJQPS+j0YkMTxUxyG58HJnN2+adfj5sWQWoqgtp1XQ== +jotai@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/jotai/-/jotai-2.0.3.tgz#3b67cda9f6d5feb70a14db0b842a9873aacda8b5" + integrity sha512-MMjhSPAL3RoeZD9WbObufRT2quThEAEknHHridf2ma8Ml7ZVQmUiHk0ssdbR3F0h3kcwhYqSGJ59OjhPge7RRg== js-sdsl@^4.1.4: version "4.3.0"