Update preliminary tanstack-db integration and JS dependencies.

This commit is contained in:
Sebastian Jeltsch
2025-07-12 11:38:39 +02:00
parent 8cb5b3ae1c
commit 13a252a8be
14 changed files with 953 additions and 1188 deletions
+4 -4
View File
@@ -7,12 +7,12 @@
"manual-test": "vitest run # Not hermetic, don't run @CI"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@types/node": "^24.0.10",
"eslint": "^9.30.1",
"@eslint/js": "^9.31.0",
"@types/node": "^24.0.13",
"eslint": "^9.31.0",
"prettier": "^3.6.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"typescript-eslint": "^8.36.0",
"vitest": "^3.2.4"
},
"dependencies": {
+6 -6
View File
@@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/starlight": "^0.34.4",
"@astrojs/starlight": "^0.34.5",
"@astrojs/starlight-tailwind": "^4.0.1",
"@iconify-json/tabler": "^1.2.19",
"@tailwindcss/vite": "^4.1.11",
@@ -23,7 +23,7 @@
"chartjs-chart-error-bars": "^4.4.4",
"chartjs-plugin-deferred": "^2.0.0",
"clsx": "^2.1.1",
"sharp": "^0.34.2",
"sharp": "^0.34.3",
"solid-js": "^1.9.7",
"starlight-links-validator": "^0.17.0",
"starlight-openapi": "^0.19.1",
@@ -34,16 +34,16 @@
"devDependencies": {
"@astrojs/sitemap": "^3.4.1",
"@astrojs/solid-js": "^5.1.0",
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"astro-robots-txt": "^1.0.0",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-solid": "^0.14.5",
"eslint-plugin-tailwindcss": "4.0.0-alpha.0",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.13",
"typescript-eslint": "^8.35.1"
"prettier-plugin-tailwindcss": "^0.6.14",
"typescript-eslint": "^8.36.0"
}
}
+4 -4
View File
@@ -25,11 +25,11 @@
},
"devDependencies": {
"@astrojs/solid-js": "^5.1.0",
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@iconify-json/tabler": "^1.2.19",
"@tailwindcss/typography": "^0.5.16",
"@types/dateformat": "^5.0.3",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-solid": "^0.14.5",
"eslint-plugin-tailwindcss": "^3.18.0",
@@ -37,8 +37,8 @@
"prettier": "^3.6.2",
"prettier-plugin-astro": "^0.14.1",
"quicktype": "^23.2.6",
"sharp": "^0.34.2",
"sharp": "^0.34.3",
"tailwindcss": "^3.4.17",
"typescript-eslint": "^8.35.1"
"typescript-eslint": "^8.36.0"
}
}
+4 -4
View File
@@ -15,17 +15,17 @@
"react-dom": "^19.1.0"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.2"
"typescript-eslint": "^8.36.0",
"vite": "^7.0.4"
}
}
+5 -5
View File
@@ -17,19 +17,19 @@
"trailbase": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@types/express": "^5.0.3",
"@types/node": "^24.0.10",
"@types/node": "^24.0.13",
"compression": "^1.8.0",
"cross-env": "^7.0.3",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"express": "^5.1.0",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"sirv": "^3.0.1",
"tailwindcss": "^3.4.17",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.2",
"typescript-eslint": "^8.36.0",
"vite": "^7.0.4",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-solid": "^2.11.7"
}
+4 -4
View File
@@ -11,14 +11,14 @@
"check": "tsc --noEmit --skipLibCheck && eslint"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@types/node": "^24.0.10",
"eslint": "^9.30.1",
"@eslint/js": "^9.31.0",
"@types/node": "^24.0.13",
"eslint": "^9.31.0",
"prettier": "^3.6.2",
"quicktype": "^23.2.6",
"ts-node": "^10.9.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1"
"typescript-eslint": "^8.36.0"
},
"dependencies": {
"csv-parse": "^5.6.0",
+10 -10
View File
@@ -12,28 +12,28 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/db": "^0.0.14",
"@tanstack/db-collections": "^0.0.18",
"@tanstack/query-core": "^5.81.5",
"@tanstack/react-db": "^0.0.14",
"@tanstack/store": "^0.7.1",
"@tanstack/db": "^0.0.20",
"@tanstack/db-collections": "^0.0.24",
"@tanstack/query-core": "^5.83.0",
"@tanstack/react-db": "^0.0.20",
"@tanstack/store": "^0.7.2",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"trailbase": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.13",
"prettier-plugin-tailwindcss": "^0.6.14",
"typescript": "~5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.2"
"typescript-eslint": "^8.36.0",
"vite": "^7.0.4"
}
}
+1 -4
View File
@@ -44,10 +44,7 @@ function App() {
const [input, setInput] = useState("");
const { data } = useLiveQuery((q) =>
q
.from({ dataCollection })
.orderBy(`@updated`)
.select(`@id`, `@updated`, `@data`),
q.from({ record: dataCollection }).orderBy(({ record }) => record.updated),
);
function handleSubmit(e: FormEvent) {
+30 -14
View File
@@ -66,7 +66,7 @@ export function trailBaseCollectionOptions<TItem extends object>(
const now = Date.now();
let anyExpired = false;
const notExpired = curr.entries().filter(([_, v]) => {
const notExpired = Array.from(curr.entries()).filter(([_, v]) => {
const expired = now - v > 300 * 1000;
anyExpired = anyExpired || expired;
return !expired;
@@ -85,6 +85,14 @@ export function trailBaseCollectionOptions<TItem extends object>(
type SyncParams = Parameters<SyncConfig<TItem>[`sync`]>[0];
let eventReader: ReadableStreamDefaultReader<Event> | undefined;
const cancel = () => {
if (eventReader) {
eventReader.cancel();
eventReader.releaseLock();
eventReader = undefined;
}
};
const sync = {
sync: (params: SyncParams) => {
const { begin, write, commit } = params;
@@ -127,10 +135,7 @@ export function trailBaseCollectionOptions<TItem extends object>(
}
// Afterwards subscribe.
async function subscribe() {
const eventStream = await config.recordApi.subscribe(`*`);
const reader = (eventReader = eventStream.getReader());
async function listen(reader: ReadableStreamDefaultReader<Event>) {
while (true) {
const { done, value: event } = await reader.read();
@@ -166,13 +171,30 @@ export function trailBaseCollectionOptions<TItem extends object>(
}
}
initialFetch().then(() => subscribe());
async function start() {
const eventStream = await config.recordApi.subscribe(`*`);
const reader = (eventReader = eventStream.getReader());
// Start listening for subscriptions first. Otherwise, we'd risk a gap
// between the initial fetch and starting to listen.
listen(reader);
try {
await initialFetch();
} catch (e) {
cancel();
throw e;
}
}
start();
},
// Expose the getSyncMetadata function
getSyncMetadata: undefined,
};
return {
...config,
sync,
getKey,
onInsert: async (params): Promise<Array<number | string>> => {
@@ -182,7 +204,7 @@ export function trailBaseCollectionOptions<TItem extends object>(
if (type !== `insert`) {
throw new Error(`Expected 'insert', got: ${type}`);
}
return changes as TItem;
return changes;
}),
);
@@ -230,13 +252,7 @@ export function trailBaseCollectionOptions<TItem extends object>(
await awaitIds(ids);
},
utils: {
cancel: () => {
if (eventReader) {
eventReader.cancel();
eventReader.releaseLock();
eventReader = undefined;
}
},
cancel,
},
};
}
+865 -1113
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -27,8 +27,8 @@
"@panzoom/panzoom": "^4.6.0",
"@solid-primitives/memo": "^1.4.3",
"@solidjs/router": "^0.15.3",
"@tanstack/solid-form": "^1.12.4",
"@tanstack/solid-query": "^5.81.5",
"@tanstack/solid-form": "^1.14.0",
"@tanstack/solid-query": "^5.83.0",
"@tanstack/solid-table": "^8.21.3",
"@tanstack/table-core": "^8.21.3",
"chart.js": "^4.5.0",
@@ -49,29 +49,29 @@
"uuid": "^11.1.0"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@iconify-json/tabler": "^1.2.19",
"@solidjs/testing-library": "^0.8.10",
"@tailwindcss/typography": "^0.5.16",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/user-event": "^14.6.1",
"@types/geojson": "^7946.0.16",
"@types/leaflet": "^1.9.19",
"@types/leaflet": "^1.9.20",
"@types/wicg-file-system-access": "^2023.10.6",
"autoprefixer": "^10.4.21",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-solid": "^0.14.5",
"eslint-plugin-tailwindcss": "^3.18.0",
"globals": "^16.3.0",
"jsdom": "^26.1.0",
"postcss": "^8.5.6",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.13",
"prettier-plugin-tailwindcss": "^0.6.14",
"tailwindcss": "^3.4.17",
"ts-proto": "^2.7.5",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.2",
"typescript-eslint": "^8.36.0",
"vite": "7.0.2",
"vite-plugin-solid": "^2.11.7",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4"
+5 -5
View File
@@ -29,20 +29,20 @@
"trailbase": "file:../client"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"@eslint/js": "^9.31.0",
"@iconify-json/tabler": "^1.2.19",
"@tailwindcss/typography": "^0.5.16",
"eslint": "^9.30.1",
"eslint": "^9.31.0",
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-solid": "^0.14.5",
"eslint-plugin-tailwindcss": "^3.18.0",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.13",
"sharp": "^0.34.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"sharp": "^0.34.3",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1"
"typescript-eslint": "^8.36.0"
}
}
+3 -3
View File
@@ -35,8 +35,8 @@
"check": "tsc --noEmit --skipLibCheck && eslint"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"eslint": "^9.30.1",
"@eslint/js": "^9.31.0",
"eslint": "^9.31.0",
"execa": "^9.6.0",
"globals": "^16.3.0",
"http-status": "^2.1.0",
@@ -45,7 +45,7 @@
"prettier": "^3.6.2",
"tinybench": "^4.0.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"typescript-eslint": "^8.36.0",
"vite-node": "^3.2.4",
"vitest": "^3.2.4"
},
+4 -4
View File
@@ -12,12 +12,12 @@
"test": "vitest run"
},
"devDependencies": {
"@eslint/js": "^9.30.1",
"eslint": "^9.30.1",
"@eslint/js": "^9.31.0",
"eslint": "^9.31.0",
"prettier": "^3.6.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.2",
"typescript-eslint": "^8.36.0",
"vite": "^7.0.4",
"vite-plugin-dts": "^4.5.4",
"vitest": "^3.2.4"
}