@@ -27,7 +27,10 @@ export const memo = <T extends Component.Component<any, any, any, any>>(
|
||||
self: T
|
||||
): T & Memo<Component.Component.Props<T>> => Object.setPrototypeOf(
|
||||
Object.assign(function() {}, self),
|
||||
Object.freeze({ ...Object.getPrototypeOf(self), ...MemoProto }),
|
||||
Object.freeze(Object.setPrototypeOf(
|
||||
Object.assign({}, MemoProto),
|
||||
Object.getPrototypeOf(self),
|
||||
)),
|
||||
)
|
||||
|
||||
export const withOptions: {
|
||||
|
||||
@@ -59,7 +59,10 @@ export const suspense = <T extends Component.Component<any, any, any, any>>(
|
||||
& Suspense
|
||||
) => Object.setPrototypeOf(
|
||||
Object.assign(function() {}, self),
|
||||
Object.freeze({ ...Object.getPrototypeOf(self), ...SuspenseProto }),
|
||||
Object.freeze(Object.setPrototypeOf(
|
||||
Object.assign({}, SuspenseProto),
|
||||
Object.getPrototypeOf(self),
|
||||
)),
|
||||
)
|
||||
|
||||
export const withOptions: {
|
||||
|
||||
@@ -25,16 +25,12 @@ const RouteComponent = Component.makeUntraced(function* RouteComponent() {
|
||||
Component.withRuntime(runtime.context)
|
||||
)
|
||||
|
||||
const SubComponent = Component.makeUntraced(function* SubComponent() {
|
||||
class SubComponent extends Component.makeUntraced(function* SubComponent() {
|
||||
const id = yield* makeUuid4.pipe(Effect.provide(GetRandomValues.CryptoRandom))
|
||||
return <Text>{id}</Text>
|
||||
})
|
||||
}) {}
|
||||
|
||||
class MemoizedSubComponent extends Memo.memo(SubComponent) {}
|
||||
console.log(MemoizedSubComponent.prototype)
|
||||
|
||||
// console.log(Object.getPrototypeOf(SubComponent))
|
||||
// console.log(Object.getPrototypeOf(MemoizedSubComponent))
|
||||
|
||||
export const Route = createFileRoute("/dev/memo")({
|
||||
component: RouteComponent,
|
||||
|
||||
Reference in New Issue
Block a user