@tanstack/cta-framework-react-cra 0.22.1 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,5 +43,9 @@ export function subscribeToTodos(callback: (todos: Todo[]) => void) {
43
43
 
44
44
  // Notify all subscribers of a user's cart
45
45
  function notifySubscribers() {
46
- subscribers.forEach((cb) => cb(todos))
46
+ for (const cb of subscribers) {
47
+ try {
48
+ cb(todos)
49
+ } catch {}
50
+ }
47
51
  }
@@ -8,9 +8,13 @@ export const Route = createFileRoute('/api/mcp-todos')({
8
8
  GET: () => {
9
9
  const stream = new ReadableStream({
10
10
  start(controller) {
11
- setInterval(() => {
12
- controller.enqueue(`event: ping\n\n`)
13
- }, 1000)
11
+ function ping() {
12
+ try {
13
+ controller.enqueue(`event: ping\n\n`)
14
+ setTimeout(ping, 1000)
15
+ } catch {}
16
+ }
17
+ ping()
14
18
  const unsubscribe = subscribeToTodos((todos) => {
15
19
  controller.enqueue(`data: ${JSON.stringify(todos)}\n\n`)
16
20
  })
@@ -31,8 +31,6 @@ export async function handleMcpRequest(
31
31
  await clientTransport.close()
32
32
  await serverTransport.close()
33
33
 
34
- console.log('responseData', JSON.stringify(responseData, null, 2))
35
-
36
34
  return Response.json(responseData, {
37
35
  headers: {
38
36
  'Content-Type': 'application/json',
@@ -1,3 +1,4 @@
1
1
  # These will be automatically created by Neon Launchpad (https://neon.new).
2
- DATABASE_URL=
3
- DATABASE_URL_POOLER=
2
+ # You will also need to
3
+ VITE_DATABASE_URL=
4
+ VITE_DATABASE_URL_POOLER=
@@ -3,11 +3,11 @@ import { neon } from '@neondatabase/serverless'
3
3
  let client: ReturnType<typeof neon>
4
4
 
5
5
  export async function getClient() {
6
- if (!process.env.DATABASE_URL) {
6
+ if (!process.env.VITE_DATABASE_URL) {
7
7
  return undefined
8
8
  }
9
9
  if (!client) {
10
- client = await neon(process.env.DATABASE_URL!)
10
+ client = await neon(process.env.VITE_DATABASE_URL!)
11
11
  }
12
12
  return client
13
13
  }
@@ -16,7 +16,8 @@ const config = defineConfig({
16
16
  type: "sql-script",
17
17
  path: "db/init.sql"
18
18
  },
19
- referrer: 'create-tanstack'
19
+ referrer: 'create-tanstack',
20
+ dotEnvKey: 'VITE_DATABASE_URL',
20
21
  }),
21
22
  <% } %>
22
23
  // this is the plugin that enables path aliases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-framework-react-cra",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "description": "CTA Framework for React (Create React App)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "author": "Jack Herrington <jherr@pobox.com>",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@tanstack/cta-engine": "0.22.1"
26
+ "@tanstack/cta-engine": "0.22.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.13.4",