with connection pooling

main
Laurin Weger 2 weeks ago
parent 760bfb79cb
commit a5044cdb44
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 2
      src/frontends/react/HelloWorld.tsx
  2. 5
      src/ng-mock/js-land/connector/ngSignals.ts

@ -2,7 +2,7 @@ import React from "react";
import useShape from "../../ng-mock/js-land/frontendAdapters/react/useShape";
export function HelloWorldReact() {
const state = useShape("Shape2", "");
const state = useShape("Shape1", "");
window.reactState = state;
console.log("react render", state);

@ -5,8 +5,12 @@ import { applyDiff } from "./applyDiff";
import { batch, deepSignal, watch } from "alien-deepsignals";
import { signal } from "alien-signals";
const openConnections: Record<Shape, ReturnType<typeof signal>> = {};
// TODO: The code is horrible.
export function createSignalObjectForShape(shape: Shape, scope?: Scope) {
if (openConnections[shape]) return openConnections[shape];
// TODO:
// DeepSignal has a different API to alien-signals.
// Therefore, we need to create a "root signal" wrapper that is
@ -66,5 +70,6 @@ export function createSignalObjectForShape(shape: Shape, scope?: Scope) {
}
);
openConnections[shape] = rootSignal;
return rootSignal;
}

Loading…
Cancel
Save