Skip to content

Commit

Permalink
feat(store): remove valtio as it wasnt the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4x committed Apr 18, 2023
1 parent 0843ccb commit 0dcb52b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@iam4x/valtio": "^1.10.5",
"axios": "^1.3.3",
"axios-rate-limit": "^1.3.0",
"axios-retry": "^3.4.0",
Expand Down
9 changes: 3 additions & 6 deletions src/store/store.base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { proxy, snapshot } from '@iam4x/valtio/dist/vanilla';

import type { Order, Position, StoreData, Ticker, Writable } from '../types';
import { clone } from '../utils/clone';

Expand All @@ -26,7 +24,7 @@ export const defaultStore: StoreData = {

export class DefaultStore implements Store {
private listeners = new Set<(data: StoreData) => void>();
private state = proxy<Writable<StoreData>>(clone(defaultStore));
private state: Writable<StoreData> = clone(defaultStore);

get latency() {
return this.state.latency;
Expand Down Expand Up @@ -66,7 +64,7 @@ export class DefaultStore implements Store {
};

reset = () => {
this.state = proxy<Writable<StoreData>>(clone(defaultStore));
this.state = clone(defaultStore);
this.notify();
};

Expand Down Expand Up @@ -202,8 +200,7 @@ export class DefaultStore implements Store {

private notify = () => {
if (this.listeners.size > 0) {
const data = snapshot(this.state);
this.listeners.forEach((cb) => cb(data as StoreData));
this.listeners.forEach((cb) => cb(this.state));
}
};
}
18 changes: 0 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@iam4x/valtio@^1.10.5":
version "1.10.5"
resolved "https://registry.yarnpkg.com/@iam4x/valtio/-/valtio-1.10.5.tgz#751ec0d59c16ec33ba68152a92a1a0c88fd91be1"
integrity sha512-7qH+bCIVxMAwnrqqSCDOCptrbk1QTWhtbmRJYGRJawEWrIENRCMykReOcFAsS7TvuiQWrmqNKJFUJ2s7fYwVOg==
dependencies:
proxy-compare "2.5.0"
use-sync-external-store "1.2.0"

"@jridgewell/resolve-uri@^3.0.3":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
Expand Down Expand Up @@ -1535,11 +1527,6 @@ prettier@^2.8.3:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450"
integrity sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==

proxy-compare@2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/proxy-compare/-/proxy-compare-2.5.0.tgz#0387c5e4d283ba9b1c0353bb20def4449b06bbd2"
integrity sha512-f1us0OsVAJ3tdIMXGQx2lmseYS4YXe4W+sKF5g5ww/jV+5ogMadPt+sIZ+88Ga9kvMJsrRNWzCrKPpr6pMWYbA==

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
Expand Down Expand Up @@ -1868,11 +1855,6 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

use-sync-external-store@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

util-deprecate@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down

0 comments on commit 0dcb52b

Please sign in to comment.