Comments (5)
Sorry for the delay. I am currently not actively using this myself. I reviewed & merged it and updated some dependencies along the way. Tagged v2.0.0 including this.
from graphql-transport-electron.
Seems like this is the issue:
graphql-transport-electron/src/client.ts
Line 32 in 7e76213
from graphql-transport-electron.
It seems like we should allow passing a context serializer as a callback to the ApolloIpcLink options. That way, by default we could simply ignore the context (context: undefined
) but allow implementations that depend on it to send custom values to the main process to control how they are serialized.
Would you mind submitting a PR for this? You could also consider upgrading the dependencies for apollo to v3. I currently don't use this library myself so would appreciate a PR for this! Thanks
from graphql-transport-electron.
While we're waiting for merging the PR above, here's a monkey patch
IpcLinkPatched.ts
/* eslint-disable */
import { FetchResult, Observable, Operation } from '@apollo/client';
import { print } from 'graphql';
import { IpcLink as IpcLinkOriginal } from 'graphql-transport-electron';
// @ts-ignore
export class IpcLink extends IpcLinkOriginal {
private counter;
private observers;
private ipc;
private channel;
request(operation: Operation): any {
return new Observable(
(observer: ZenObservable.SubscriptionObserver<FetchResult>) => {
const current = `${++this.counter}`;
const request = {
operationName: operation.operationName,
variables: operation.variables,
query: print(operation.query),
context: JSON.parse(
JSON.stringify(operation.getContext(), createSerializer())
),
};
this.observers.set(current, observer);
this.ipc.send(this.channel, current, request);
},
);
}
}
export function createIpcLink(options) {
return new IpcLink(options);
}
function createSerializer() {
var seen = new WeakSet();
return function (key, value) {
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return undefined;
}
seen.add(value);
}
return value;
};
}
from graphql-transport-electron.
@fubhy could you please review the PR made by @xEcEz ?
from graphql-transport-electron.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-transport-electron.