Có một số hàm ở server sẽ không serialize được
Passing props to islands is supported, but only if the props are serializable. Fresh can serialize the following types of values:
- Primitive types
string
,boolean
,bigint
, andnull
- Most
number
s (Infinity
,-Infinity
, andNaN
are silently converted tonull
) - Plain objects with string keys and serializable values
- Arrays containing serializable values
- Uint8Array
- JSX Elements (restricted to
props.children
) - Preact Signals (if the inner value is serializable)
Circular references are supported. If an object or signal is referenced multiple times, it is only serialized once and the references are restored upon deserialization. Passing complex objects like Date
, custom classes, or functions is not supported.
Trích từ:: Interactive islands | Fresh docs
Why is a function not serializable?
Hệ quả là Route không bao giờ được gửi đến client. Island được chạy ở cả server và client