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

@ssrx/plugin-tanstack-query

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ssrx/plugin-tanstack-query - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

94

dist/index.js

@@ -66,64 +66,50 @@ // src/plugin.tsx

// src/plugin.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var PLUGIN_ID = "tanstackQuery";
var tanstackQueryPlugin = ({
QueryClientProvider,
skipHydration,
queryClientConfig,
devTools
}) => defineRenderPlugin({
var tanstackQueryPlugin = ({ provider, skipHydration, queryClientConfig }) => defineRenderPlugin({
id: PLUGIN_ID,
createCtx: () => {
hooksForReq: () => {
const trackedQueries = /* @__PURE__ */ new Set();
const blockingQueries = /* @__PURE__ */ new Map();
const queryClient = createQueryClient({ trackedQueries, blockingQueries, clientConfig: queryClientConfig });
if (!import.meta.env.SSR) {
if (!import.meta.env.SSR && !skipHydration) {
hydrateStreamingData({ queryClient });
}
return { trackedQueries, blockingQueries, queryClient };
},
hooks: {
"app:extendCtx": ({ ctx }) => {
const { queryClient } = ctx;
return { queryClient };
},
"app:wrap": ({ ctx }) => {
const { queryClient } = ctx;
return ({ children }) => /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
children(),
devTools ? /* @__PURE__ */ jsx(devTools.QueryDevtools, { ...devTools.options }) : null
] });
},
"ssr:emitToHead": () => {
if (skipHydration)
return;
const html = [`$TQD = [];`, `$TQS = data => $TQD.push(data);`];
return `<script>${html.join("")}</script>`;
},
"ssr:emitBeforeFlush": async ({ ctx }) => {
if (skipHydration)
return;
const { blockingQueries, trackedQueries, queryClient } = ctx;
if (blockingQueries.size) {
await Promise.allSettled(blockingQueries.values());
blockingQueries.clear();
return {
common: {
extendCtx: () => ({ queryClient }),
wrapApp: () => ({ children }) => provider({ children: children(), queryClient })
},
server: {
emitToDocumentHead: () => {
if (skipHydration)
return;
const html = [`$TQD = [];`, `$TQS = data => $TQD.push(data);`];
return `<script>${html.join("")}</script>`;
},
emitBeforeStreamChunk: async () => {
if (skipHydration)
return;
if (blockingQueries.size) {
await Promise.allSettled(blockingQueries.values());
blockingQueries.clear();
}
if (!trackedQueries.size)
return;
const shouldDehydrate = defaultShouldDehydrateQuery;
const dehydratedState = dehydrate(queryClient, {
shouldDehydrateQuery(query) {
return trackedQueries.has(query.queryHash) && shouldDehydrate(query);
}
});
trackedQueries.clear();
if (!dehydratedState.queries.length)
return;
const dehydratedString = JSON.stringify(stringify(dehydratedState));
return `<script>${[`$TQS(${dehydratedString})`].join("")}</script>`;
},
onStreamComplete: () => {
queryClient.clear();
}
}
if (!trackedQueries.size)
return;
const shouldDehydrate = defaultShouldDehydrateQuery;
const dehydratedState = dehydrate(queryClient, {
shouldDehydrateQuery(query) {
return trackedQueries.has(query.queryHash) && shouldDehydrate(query);
}
});
trackedQueries.clear();
if (!dehydratedState.queries.length)
return;
const dehydratedString = JSON.stringify(stringify(dehydratedState));
return `<script>${[`$TQS(${dehydratedString})`].join("")}</script>`;
},
"ssr:completed": ({ ctx }) => {
const { queryClient } = ctx;
queryClient.clear();
}
};
}

@@ -130,0 +116,0 @@ });

{
"name": "@ssrx/plugin-tanstack-query",
"version": "0.3.0",
"version": "0.4.0",
"sideEffects": false,

@@ -19,2 +19,3 @@ "type": "module",

".": {
"types": "./src/index.ts",
"bun": "./src/index.ts",

@@ -33,9 +34,8 @@ "default": "./dist/index.js"

"dependencies": {
"@ssrx/renderer": "^0.3.0",
"@ssrx/renderer": "^0.4.0",
"devalue": "^4.3.2"
},
"devDependencies": {
"@tanstack/query-core": "^5.14.2",
"@tanstack/query-devtools": "^5.15.0"
"@tanstack/query-core": "^5.18.0"
}
}

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