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

relay-nextjs

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relay-nextjs - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

5

component.d.ts
import type { NextPageContext, Redirect } from 'next';
import { NextRouter } from 'next/router';
import { ComponentType, ReactNode } from 'react';
import { PreloadedQuery } from 'react-relay';
import { PreloadFetchPolicy, PreloadedQuery } from 'react-relay';
import { Environment, GraphQLResponse, GraphQLTaggedNode, OperationDescriptor, OperationType } from 'relay-runtime';

@@ -33,2 +33,5 @@ import { HydrationMeta } from './json_meta';

serverSideProps?: (ctx: NextPageContext) => Promise<OrRedirect<ServerSideProps>>;
fetchPolicy?: PreloadFetchPolicy;
/** Runs after a query has been executed on the server. */
serverSidePostQuery?: (queryResult: GraphQLResponse | undefined, ctx: NextPageContext) => Promise<unknown> | unknown;
}

@@ -35,0 +38,0 @@ export declare function withRelay<Props extends RelayProps, ServerSideProps extends {}>(Component: ComponentType<Props>, query: GraphQLTaggedNode, opts: RelayOptions<Props, ServerSideProps>): {

9

component.js

@@ -105,2 +105,3 @@ "use strict";

function getServerInitialProps(ctx, query, opts) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {

@@ -129,6 +130,10 @@ const { variablesFromContext = defaultVariablesFromContext } = opts;

const variables = variablesFromContext(ctx);
const preloadedQuery = (0, react_relay_1.loadQuery)(env, query, variables);
const preloadedQuery = (0, react_relay_1.loadQuery)(env, query, variables, {
fetchPolicy: (_a = opts.fetchPolicy) !== null && _a !== void 0 ? _a : 'store-and-network',
});
const payload = yield ensureQueryFlushed(preloadedQuery);
yield ((_b = opts.serverSidePostQuery) === null || _b === void 0 ? void 0 : _b.call(opts, payload, ctx));
const payloadSerializationMetadata = (0, json_meta_1.collectMeta)(payload);
const operationDescriptor = (0, relay_runtime_1.createOperationDescriptor)(query.default, variables);
const request = query;
const operationDescriptor = (0, relay_runtime_1.createOperationDescriptor)('default' in request ? request.default : request, variables);
const props = Object.assign(Object.assign({}, serverSideProps), { CSN: false, operationDescriptor,

@@ -135,0 +140,0 @@ payload, payloadMeta: payloadSerializationMetadata });

{
"name": "relay-nextjs",
"version": "2.0.0",
"version": "2.0.1",
"description": "Use Relay in your Next.js apps!",

@@ -5,0 +5,0 @@ "main": "index.js",

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