New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/client-react-streaming

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client-react-streaming - npm Package Compare versions

Comparing version 0.9.2 to 0.10.0

18

dist/index.browser.js

@@ -5,3 +5,3 @@ import { ApolloLink, InMemoryCache as InMemoryCache$1, ApolloProvider, Observable as Observable$1, ApolloClient as ApolloClient$1 } from '@apollo/client/index.js';

import { invariant } from 'ts-invariant';
import React, { createContext, useRef, useState, useEffect, useContext } from 'react';
import React, { createContext, useRef, useContext, useSyncExternalStore } from 'react';

@@ -149,4 +149,2 @@ // src/AccumulateMultipartResponsesLink.ts

function useTransportValue(value) {
const [isClient, setIsClient] = useState(false);
useEffect(() => setIsClient(true), []);
const dataTransport = useContext(DataTransportContext);

@@ -158,6 +156,12 @@ if (!dataTransport)

const valueRef = dataTransport.useStaticValueRef(value);
if (isClient) {
const retVal = useSyncExternalStore(
() => () => {
},
() => value,
() => valueRef.current
);
if (retVal === value) {
valueRef.current = void 0;
}
return isClient ? value : valueRef.current;
return retVal;
}

@@ -214,3 +218,5 @@

constructor(options) {
super(options);
super(
options
);
if (!(this.cache instanceof InMemoryCache)) {

@@ -217,0 +223,0 @@ throw new Error(

@@ -6,4 +6,41 @@ import { cache } from 'react';

// src/registerApolloClient.tsx
var seenWrappers = WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
var seenClients = WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
function registerApolloClient(makeClient) {
const getClient = cache(makeClient);
function makeWrappedClient() {
return { client: makeClient() };
}
const cachedMakeWrappedClient = cache(makeWrappedClient);
function getClient() {
if (arguments.length) {
throw new Error(
`
You cannot pass arguments into \`getClient\`.
Passing arguments to \`getClient\` returns a different instance
of Apollo Client each time it is called with different arguments, potentially
resulting in duplicate requests and a non-functional cache.
`.trim()
);
}
const wrapper = cachedMakeWrappedClient();
if (seenWrappers && seenClients) {
if (!seenWrappers.has(wrapper)) {
if (seenClients.has(wrapper.client)) {
console.warn(
`
Multiple calls to \`getClient\` for different requests returned the same client instance.
This means that private user data could accidentally be shared between requests.
This happens, for example, if you create a global \`ApolloClient\` instance and your \`makeClient\`
implementation just looks like \`() => client\`.
Always call \`new ApolloClient\` **inside** your \`makeClient\` function and
return a new instance every time \`makeClient\` is called.
`.trim()
);
}
seenWrappers.add(wrapper);
seenClients.add(wrapper.client);
}
}
return wrapper.client;
}
return {

@@ -164,3 +201,8 @@ getClient

constructor(options) {
super(options);
super(
{
connectToDevTools: false,
...options
}
);
if (!(this.cache instanceof InMemoryCache)) {

@@ -167,0 +209,0 @@ throw new Error(

import { ApolloLink, InMemoryCache as InMemoryCache$1, ApolloProvider, Observable as Observable$1, ApolloClient as ApolloClient$1 } from '@apollo/client/index.js';
import { hasDirectives, Observable, removeDirectivesFromDocument, mergeIncrementalData } from '@apollo/client/utilities/index.js';
import React, { createContext, useRef, useState, useEffect, useContext } from 'react';
import React, { createContext, useRef, useContext, useSyncExternalStore } from 'react';

@@ -165,4 +165,2 @@ // src/AccumulateMultipartResponsesLink.ts

function useTransportValue(value) {
const [isClient, setIsClient] = useState(false);
useEffect(() => setIsClient(true), []);
const dataTransport = useContext(DataTransportContext);

@@ -174,6 +172,12 @@ if (!dataTransport)

const valueRef = dataTransport.useStaticValueRef(value);
if (isClient) {
const retVal = useSyncExternalStore(
() => () => {
},
() => value,
() => valueRef.current
);
if (retVal === value) {
valueRef.current = void 0;
}
return isClient ? value : valueRef.current;
return retVal;
}

@@ -230,3 +234,8 @@

constructor(options) {
super(options);
super(
{
connectToDevTools: false,
...options
}
);
if (!(this.cache instanceof InMemoryCache)) {

@@ -233,0 +242,0 @@ throw new Error(

{
"name": "@apollo/client-react-streaming",
"version": "0.9.2",
"version": "0.10.0",
"repository": {

@@ -137,2 +137,3 @@ "url": "git+https://github.com/apollographql/apollo-client-nextjs"

"react-error-boundary": "4.0.13",
"react-server-dom-webpack": "18.3.0-canary-60a927d04-20240113",
"rimraf": "5.0.5",

@@ -139,0 +140,0 @@ "superjson": "1.13.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc