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
0
Versions
38
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.0.0-commit-release.0.1724057095.215fb1d to 0.0.0-commit-release.0.1724057834.81b5532

dist/SimulatePreloadedQuery.cc.cjs

4

dist/index.cc.d.ts

@@ -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
);
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;
}
// src/index.cc.tsx
import * as React from "react";
var SimulatePreloadedQuery = React.lazy(() => import("./SimulatePreloadedQuery.cc.js"));
export {

@@ -74,0 +7,0 @@ SimulatePreloadedQuery

import React, { cache } from 'react';
import { SimulatePreloadedQuery } from './index.cc.js';
import { ApolloLink, InMemoryCache as InMemoryCache$1, ApolloClient as ApolloClient$1 } from '@apollo/client/index.js';

@@ -1186,3 +1187,2 @@ import { hasDirectives, Observable, removeDirectivesFromDocument, mergeIncrementalData, print } from '@apollo/client/utilities/index.js';

// src/PreloadQuery.tsx
var SimulatePreloadedQuery;
function PreloadQuery({

@@ -1193,9 +1193,2 @@ getClient,

}) {
if (!SimulatePreloadedQuery) {
SimulatePreloadedQuery = React.lazy(
() => import('./index.cc.js').then((pkg) => ({
default: pkg.SimulatePreloadedQuery
}))
);
}
const preloadOptions = {

@@ -1202,0 +1195,0 @@ ...options,

{
"name": "@apollo/client-react-streaming",
"version": "0.0.0-commit-release.0.1724057095.215fb1d",
"version": "0.0.0-commit-release.0.1724057834.81b5532",
"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

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