Skip to content

Commit

Permalink
Merge branch 'trusktr-update-dom-expressions' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Sep 23, 2024
2 parents 120bf06 + d83e57c commit 0f8a4fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
22 changes: 22 additions & 0 deletions packages/solid/store/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import type { SetStoreFunction, Store } from "./store.js";

export type {
ArrayFilterFn,
DeepMutable,
DeepReadonly,
NotWrappable,
Part,
SetStoreFunction,
SolidStore,
Store,
StoreNode,
StorePathRange,
StoreSetter
} from "./store.js";

export const $RAW = Symbol("state-raw");

export function isWrappable(obj: any) {
Expand Down Expand Up @@ -103,6 +117,10 @@ export function createMutable<T>(state: T | Store<T>): T {
return state as T;
}

export function modifyMutable<T>(state: T, modifier: (state: T) => T) {
notSup();
}

type ReconcileOptions = {
key?: string | null;
merge?: boolean;
Expand Down Expand Up @@ -137,3 +155,7 @@ export function produce<T>(fn: (state: T) => void): (state: T) => T {
}

export const DEV = undefined;

function notSup(): never {
throw new Error("not supported on server side");
}
2 changes: 1 addition & 1 deletion packages/solid/store/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type DataNode = {
(): any;
$(value?: any): void;
};
type DataNodes = Record<PropertyKey, DataNode | undefined>;
export type DataNodes = Record<PropertyKey, DataNode | undefined>;

export type OnStoreNodeUpdate = (
state: StoreNode,
Expand Down
3 changes: 3 additions & 0 deletions packages/solid/web/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ export {
Match,
Index,
ErrorBoundary,
// This overrides mergeProps from dom-expressions/src/server.js
mergeProps
} from "solid-js";

export const isServer: boolean = true;
export const isDev: boolean = false;

// Types for these come from dom-expressions/src/server.d.ts
// These override the functions from dom-expressions that throw on the serverside.
export function render() {}
export function hydrate() {}
export function insert() {}
Expand Down

0 comments on commit 0f8a4fc

Please sign in to comment.