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
1
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 0.3.0 to 0.4.0

2

package.json
{
"name": "relay-nextjs",
"version": "0.3.0",
"version": "0.4.0",
"description": "Use Relay in your Next.js apps!",

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

import type { NextPageContext, Redirect } from 'next';
import { NextRouter } from 'next/router';
import { ComponentType, ReactNode } from 'react';
import { PreloadedQuery } from 'react-relay/hooks';
import { Environment, GraphQLTaggedNode, OperationType, Variables } from 'relay-runtime';
export interface WiredOptions<ServerSideProps = {}> {
import { Environment, GraphQLTaggedNode, OperationType } from 'relay-runtime';
export declare type WiredProps<P extends {} = {}, Q extends OperationType = OperationType> = P & {
CSN: boolean;
preloadedQuery: PreloadedQuery<Q>;
};
export interface WiredOptions<Props extends WiredProps, ServerSideProps = {}> {
/** Fallback rendered when the page suspends. */
fallback?: ReactNode;
variablesFromContext?: (ctx: NextPageContext) => Variables;
variablesFromContext?: (ctx: NextPageContext | NextRouter) => Props['preloadedQuery']['variables'];
/** Called when creating a Relay environment on the client. Should be idempotent. */

@@ -22,7 +27,3 @@ createClientEnvironment: () => Environment;

}
export declare type WiredProps<P extends {} = {}, Q extends OperationType = OperationType> = P & {
CSN: boolean;
preloadedQuery: PreloadedQuery<Q>;
};
export declare function Wire<Props extends WiredProps, ServerSideProps>(Component: ComponentType<Props>, query: GraphQLTaggedNode, opts: WiredOptions<ServerSideProps>): {
export declare function Wire<Props extends WiredProps, ServerSideProps>(Component: ComponentType<Props>, query: GraphQLTaggedNode, opts: WiredOptions<Props, ServerSideProps>): {
(props: Props): JSX.Element;

@@ -29,0 +30,0 @@ getInitialProps: (ctx: NextPageContext) => Promise<{

@@ -51,4 +51,5 @@ "use strict";

react_1.useEffect(() => {
loadQuery(router.query);
}, [loadQuery, router.query]);
var _a;
loadQuery(((_a = opts.variablesFromContext) !== null && _a !== void 0 ? _a : defaultVariablesFromContext)(router));
}, [loadQuery, router]);
if (props.CSN) {

@@ -55,0 +56,0 @@ return (jsx_runtime_1.jsx(error_boundry_1.WiredErrorBoundry, { children: jsx_runtime_1.jsx(react_1.Suspense, Object.assign({ fallback: (_a = opts.fallback) !== null && _a !== void 0 ? _a : 'Loading...' }, { children: jsx_runtime_1.jsx(Component, Object.assign({}, props, { preloadedQuery: queryReference }), void 0) }), void 0) }, void 0));

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