GoogleChromeLabs / GoogleChromeLabs/comlink

Returning a collection - transferHandlers to be called

Open
#666 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

Given an exposed interface.

```
interface Service {
find: (x) => ClassInstance
findAll: (x)=> ClassInstance[]
}
```

I can properly call both methods - but the transferHandlers implementing `ClassInstance` does not get called when handling the response from `findAll` method - resulting in issues on the other side.

Are nested - non-transferable objects expected to be serialized by default? Implementation says no since only the root return value is passed to `toWireValue` .

Is it expected that the custom transferHandlers should inspect canHandle values for expected collections and serialize them directly?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.