
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
vike-solid-query
Advanced tools
<!-- WARNING: keep links absolute in this file so they work on NPM too -->
vike-solid-query
Enables your Solid components to fetch data using TanStack Query.
[!NOTE] You'll also get progressive rendering and supports for triggering SolidJS Suspense and ErrorBoundary components when the query is in a pending or error state.
Installation
Basic usage
QueryBoundary
<head>
tags
See also
npm install @tanstack/solid-query vike-solid-query
Extend +config.js
:
// pages/+config.js
import vikeSolid from 'vike-solid/config'
import vikeSolidQuery from 'vike-solid-query/config'
export default {
// ...
extends: [vikeSolid, vikeSolidQuery]
}
[!NOTE] The
vike-solid-query
extension requiresvike-solid
.
import { useQuery } from "@tanstack/solid-query";
import { Suspense } from "solid-js";
const Movie = (props: { id }) => {
const query = useQuery(() => ({
queryKey: ["movies", props.id],
queryFn: () =>
fetch(`https://brillout.github.io/star-wars/api/films/${props.id}.json`)
.then((res) => res.json()),
}));
return (
<Suspense fallback={"Loading ..."}>
Title: <b>{query.data?.title}</b>
</Suspense>
)
}
QueryBoundary
// Define the loading fallback
<QueryBoundary query={query} loadingFallback={Loading}>
{(data) => <div>{data.something}</div>}
</QueryBoundary>
// Define the loading and error fallback
<QueryBoundary query={query} loadingFallback={Loading} errorFallback={Error}>
{(data) => <div>{data.something}</div>}
</QueryBoundary>
// Define the loading, error and not found fallback
<QueryBoundary query={query} loadingFallback={Loading} errorFallback={Error} notFoundFallback={NotFound}>
{(data) => <div>{data.something}</div>}
</QueryBoundary>
Types :
query: UseQueryResult<T, Error>;
loadingFallback?: JSX.Element;
notFoundFallback?: JSX.Element;
errorFallback?: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
children: (data: Exclude<T, null | false | undefined>) => JSX.Element;
// Movie.tsx
import { useQuery } from "@tanstack/solid-query";
import { QueryBoundary } from "vike-solid-query";
function Movie(props: { id: string }) {
const query = useQuery(() => ({
queryKey: ["movies", props.id],
queryFn: () =>
fetch(`https://brillout.github.io/star-wars/api/films/${props.id}.json`)
.then((res) => res.json())
}));
return (
<QueryBoundary
query={query}
loadingFallback={<p>Loading movie {props.id}</p>}
errorFallback={(err, reset) => (
<>
<div>Failed to load movie {props.id}</div>
<button
onClick={async () => {
reset();
await query.refetch();
}}
>
Retry
</button>
</>
)}
>
{(movie) => (
<div>
Title: <b>{movie.title}</b>
</div>
)}
</QueryBoundary>
);
}
<head>
tagsTo set tags such as <title>
and <meta name="description">
based on fetched data, you can use <Config>
, <Head>
, and useConfig()
.
import { useQuery } from "@tanstack/solid-query";
import { Config } from 'vike-solid/Config'
import { Head } from 'vike-solid/Head'
import { QueryBoundary } from "vike-solid-query";
import { For } from "solid-js";
function Movies() {
const query = useQuery(() => ({
queryKey: ["movies"],
queryFn: () => fetch('https://star-wars.brillout.com/api/films.json')
}));
return (
<QueryBoundary query={query} loadingFallback={<p>Loading movies ...</p>}>
{(movies) => (
<>
<Config title={`${movies.length} Star Wars movies`} />
<Head>
<meta name="description" content={`All ${movies.length} movies from the Star Wars franchise.`} />
</Head>
<h1>Star Wars Movies</h1>
<ol>
<For each={movies}>
{(movie) => (
<li>{movie.title}</li>
)}
</For>
</ol>
</>
)}
</QueryBoundary>
)
}
You can modify the defaults defined by QueryClient
.
// +config.js
export default {
queryClientConfig: {
defaultOptions: {
queries: {
staleTime: 60 * 1000
}
}
}
}
FAQs
<!-- WARNING: keep links absolute in this file so they work on NPM too -->
The npm package vike-solid-query receives a total of 2 weekly downloads. As such, vike-solid-query popularity was classified as not popular.
We found that vike-solid-query demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.