Skip to content

Commit 70d2b06

Browse files
authored
mark all the components that went through devComponent (#780)
1 parent fe75113 commit 70d2b06

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/solid/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export {
2626
getOwner,
2727
runWithOwner,
2828
equalFn,
29+
$HMRCOMP,
2930
$PROXY
3031
} from "./reactive/signal";
3132
export type {

packages/solid/src/reactive/signal.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { JSX } from "../jsx";
66

77
export const equalFn = <T>(a: T, b: T) => a === b;
88
export const $PROXY = Symbol("solid-proxy");
9+
export const $HMRCOMP = Symbol('solid.js HMR component marker');
910
const signalOptions = { equals: equalFn };
1011
let ERROR: symbol | null = null;
1112
let runEffects = runQueue;
@@ -944,7 +945,10 @@ export function resumeEffects(e: Computation<any>[]) {
944945
// Dev
945946
export function devComponent<T>(Comp: (props: T) => JSX.Element, props: T) {
946947
const c: Partial<Memo<JSX.Element, JSX.Element>> = createComputation<JSX.Element, JSX.Element>(
947-
() => untrack(() => Comp(props)),
948+
() => untrack(() => {
949+
Object.assign(Comp, {[$HMRCOMP]: true});
950+
return Comp(props);
951+
}),
948952
undefined,
949953
true
950954
);

0 commit comments

Comments
 (0)