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.12.0-alpha.0 to 0.12.0-alpha.1

2

dist/manual-transport.browser.d.ts

@@ -62,3 +62,3 @@ import React from 'react';

* @example
* For usage examples, see the implementation of the `@apollo/experimental-nextjs-app-support`
* For usage examples, see the implementation of the `@apollo/client-integration-nextjs`
* [`ApolloNextAppProvider`](https://github.com/apollographql/apollo-client-nextjs/blob/c0715a05cf8ca29a3cbb9ce294cdcbc5ce251b2e/packages/experimental-nextjs-app-support/src/ApolloNextAppProvider.ts)

@@ -65,0 +65,0 @@ *

@@ -62,3 +62,3 @@ import React from 'react';

* @example
* For usage examples, see the implementation of the `@apollo/experimental-nextjs-app-support`
* For usage examples, see the implementation of the `@apollo/client-integration-nextjs`
* [`ApolloNextAppProvider`](https://github.com/apollographql/apollo-client-nextjs/blob/c0715a05cf8ca29a3cbb9ce294cdcbc5ce251b2e/packages/experimental-nextjs-app-support/src/ApolloNextAppProvider.ts)

@@ -65,0 +65,0 @@ *

@@ -37,3 +37,7 @@ import { renderToString } from 'react-dom/server';

let currentlyStreaming = false;
let tailOfLastChunk = "";
const textDecoder = new TextDecoder();
const textEncoder = new TextEncoder();
const HEAD_END = "</head>";
const KEEP_BYTES = HEAD_END.length;
const transformStream = new TransformStream({

@@ -46,7 +50,7 @@ async transform(chunk, controller) {

if (!headInserted) {
const content = textDecoder.decode(chunk, { stream: true });
const index = content.indexOf("</head>");
const content = tailOfLastChunk + textDecoder.decode(chunk, { stream: true });
const index = content.indexOf(HEAD_END);
if (index !== -1) {
const insertedHeadContent = content.slice(0, index) + await renderInjectedHtml() + content.slice(index);
controller.enqueue(new TextEncoder().encode(insertedHeadContent));
controller.enqueue(textEncoder.encode(insertedHeadContent));
currentlyStreaming = true;

@@ -58,8 +62,7 @@ setImmediate(() => {

} else {
controller.enqueue(chunk);
tailOfLastChunk = content.slice(-KEEP_BYTES);
controller.enqueue(textEncoder.encode(content.slice(0, -KEEP_BYTES)));
}
} else {
controller.enqueue(
new TextEncoder().encode(await renderInjectedHtml())
);
controller.enqueue(textEncoder.encode(await renderInjectedHtml()));
controller.enqueue(chunk);

@@ -66,0 +69,0 @@ currentlyStreaming = true;

{
"name": "@apollo/client-react-streaming",
"version": "0.12.0-alpha.0",
"version": "0.12.0-alpha.1",
"repository": {

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

"peerDependencies": {
"@apollo/client": ">=3.13.0-rc.0",
"@apollo/client": "^3.13.0",
"graphql": "^16 || >=17.0.0-alpha.2",

@@ -166,0 +166,0 @@ "react": "^18 || >=19.0.0-rc",

# `@apollo/client-react-streaming`
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/experimental-nextjs-app-support](https://github.com/apollographql/apollo-client-nextjs/tree/main/packages/experimental-nextjs-app-support) package as an example.
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/client-integration-nextjs](https://github.com/apollographql/apollo-client-nextjs/tree/main/packages/nextjs) package as an example.

@@ -5,0 +5,0 @@ It can also be used to use Apollo Client with a custom streaming SSR setup, e.g. with Vite. See the [vite streaming integration test](https://github.com/apollographql/apollo-client-nextjs/tree/main/integration-test/vite-streaming) as an example.

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