Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/client-react-streaming

Package Overview
Dependencies
Maintainers
1
Versions
35
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.11.2 to 0.11.3

dist/SimulatePreloadedQuery.cc.cjs

7

dist/combined.d.ts

@@ -20,8 +20,7 @@ import * as _apollo_client_index_js from '@apollo/client/index.js';

/**
* Only available in React Server Components.
* Will be `undefined` after being passed to Client Components.
* Temporarily disabled - see https://github.com/apollographql/apollo-client-nextjs/issues/332
*
* Returns a promise that resolves back to the `TransportedQueryRef` that can be awaited in RSC to suspend a subtree until the originating query has been loaded.
* Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution.
*/
toPromise?: () => Promise<TransportedQueryRef>;
toPromise?: undefined;
}

@@ -28,0 +27,0 @@

@@ -411,10 +411,9 @@ import * as _apollo_client_index_js from '@apollo/client/index.js';

/**
* Only available in React Server Components.
* Will be `undefined` after being passed to Client Components.
* Temporarily disabled - see https://github.com/apollographql/apollo-client-nextjs/issues/332
*
* Returns a promise that resolves back to the `TransportedQueryRef` that can be awaited in RSC to suspend a subtree until the originating query has been loaded.
* Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution.
*/
toPromise?: () => Promise<TransportedQueryRef>;
toPromise?: undefined;
}
export { ApolloClient, DataTransportContext, type DataTransportProviderImplementation, AccumulateMultipartResponsesLink as DebounceMultipartResponsesLink, InMemoryCache, type QueryEvent, RemoveMultipartDirectivesLink, SSRMultipartLink, type TransportedQueryRef, WrapApolloProvider, type WrappedApolloProvider, resetApolloSingletons };

@@ -47,3 +47,3 @@ import { WatchQueryOptions, FetchResult } from '@apollo/client/index.js';

declare function SimulatePreloadedQuery<T>({ options, result, children, queryKey, }: {
declare function SimulatePreloadedQuery$1<T>({ options, result, children, queryKey, }: {
options: TransportedQueryRefOptions;

@@ -55,2 +55,4 @@ result: Promise<Array<Omit<ProgressEvent, "id">>>;

declare const SimulatePreloadedQuery: typeof SimulatePreloadedQuery$1;
export { SimulatePreloadedQuery };
"use client";
// src/index.cc.ts
import {
skipToken,
useApolloClient,
useBackgroundQuery
} from "@apollo/client/index.js";
// src/DataTransportAbstraction/transportedOptions.ts
import { gql } from "@apollo/client/index.js";
import { print } from "@apollo/client/utilities/index.js";
function deserializeOptions(options) {
return {
...options,
// `gql` memoizes results, but based on the input string.
// We parse-stringify-parse here to ensure that our minified query
// has the best chance of being the referential same query as the one used in
// client-side code.
query: gql(print(gql(options.query)))
};
}
// src/index.cc.ts
import { useMemo } from "react";
import invariant from "ts-invariant";
var handledRequests = /* @__PURE__ */ new WeakMap();
function SimulatePreloadedQuery({
options,
result,
children,
queryKey
}) {
const client = useApolloClient();
if (!handledRequests.has(options)) {
const id = `preloadedQuery:${client["queryManager"].generateQueryId()}`;
handledRequests.set(options, id);
invariant.debug(
"Preloaded query %s started on the server, simulating ongoing request",
id
// src/index.cc.tsx
import * as React from "react";
var RealSimulatePreloadedQuery;
var SimulatePreloadedQuery = (props) => {
if (!RealSimulatePreloadedQuery) {
RealSimulatePreloadedQuery = React.lazy(
() => import("./SimulatePreloadedQuery.cc.js")
);
client.onQueryStarted({
type: "started",
id,
options
});
result.then((results) => {
invariant.debug("Preloaded query %s: received events: %o", id, results);
for (const event of results) {
client.onQueryProgress({ ...event, id });
}
});
}
const bgQueryArgs = useMemo(() => {
const { query, ...hydratedOptions } = deserializeOptions(
options
);
return [
query,
// If we didn't pass in a `queryKey` prop, the user didn't use the render props form and we don't
// need to create a real `queryRef` => skip.
// Otherwise we call `useBackgroundQuery` with options in this component to create a `queryRef`
// and have it soft-retained in the SuspenseCache.
queryKey ? {
...hydratedOptions,
queryKey
} : skipToken
];
}, [options, queryKey]);
useBackgroundQuery(...bgQueryArgs);
return children;
}
return /* @__PURE__ */ React.createElement(RealSimulatePreloadedQuery, { ...props });
};
export {

@@ -74,0 +15,0 @@ SimulatePreloadedQuery

@@ -20,8 +20,7 @@ import * as _apollo_client_index_js from '@apollo/client/index.js';

/**
* Only available in React Server Components.
* Will be `undefined` after being passed to Client Components.
* Temporarily disabled - see https://github.com/apollographql/apollo-client-nextjs/issues/332
*
* Returns a promise that resolves back to the `TransportedQueryRef` that can be awaited in RSC to suspend a subtree until the originating query has been loaded.
* Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution.
*/
toPromise?: () => Promise<TransportedQueryRef>;
toPromise?: undefined;
}

@@ -28,0 +27,0 @@

@@ -1173,3 +1173,3 @@ import React, { cache } from 'react';

}
function createTransportedQueryRef(options, queryKey, promise) {
function createTransportedQueryRef(options, queryKey, _promise) {
const ref = {

@@ -1180,6 +1180,2 @@ __transportedQueryRef: true,

};
Object.defineProperty(ref, "toPromise", {
value: () => promise.then(() => ref),
enumerable: false
});
return ref;

@@ -1222,5 +1218,3 @@ }

transportedOptions,
queryKey,
resultPromise
)
queryKey)
) : children

@@ -1227,0 +1221,0 @@ );

@@ -411,10 +411,9 @@ import * as _apollo_client_index_js from '@apollo/client/index.js';

/**
* Only available in React Server Components.
* Will be `undefined` after being passed to Client Components.
* Temporarily disabled - see https://github.com/apollographql/apollo-client-nextjs/issues/332
*
* Returns a promise that resolves back to the `TransportedQueryRef` that can be awaited in RSC to suspend a subtree until the originating query has been loaded.
* Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution.
*/
toPromise?: () => Promise<TransportedQueryRef>;
toPromise?: undefined;
}
export { ApolloClient, DataTransportContext, type DataTransportProviderImplementation, AccumulateMultipartResponsesLink as DebounceMultipartResponsesLink, InMemoryCache, type QueryEvent, RemoveMultipartDirectivesLink, SSRMultipartLink, type TransportedQueryRef, WrapApolloProvider, type WrappedApolloProvider, resetApolloSingletons };
{
"name": "@apollo/client-react-streaming",
"version": "0.11.2",
"version": "0.11.3",
"repository": {

@@ -5,0 +5,0 @@ "url": "git+https://github.com/apollographql/apollo-client-nextjs"

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

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