
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
hyperapp-fetch
Advanced tools
A component for fetching and caching data before rendering a view
Often views depend on some dynamic data that needs to be fetched from a remote location before it can render. This is a common enough pattern to warrant a generic solution. The component requires the following properties to function correctly:
cache: a place in state in which to store the fetched dataurl: a URL that is used as the url for fetched data stored in the cachedone: an action that extends the cache once data has been fetchedview: a function that gets passed the fetched data and returns a vdom nodenpm i hyperapp-fetch
import { app } from 'hyperapp'
import { Fetch } from 'hyperapp-fetch'
const state = {
users: {},
}
const actions = {
addUser: ([key, user]) => ({ users }) => ({
users: Object.assign({}, users, { [key]: user }),
}),
}
const view = (state, actions) =>
Fetch({
cache: state.users,
url: 'https://api.github.com/users/lukejacksonn',
done: actions.addUser,
view: (cache, key) => Object.keys(cache),
})
app(state, actions, view, document.body)
One of the most common use cases for a Fetch component is fetching data upon entering a route. This component will work with @hyperapp/router seamlessly. The below example will fetch a GitHub users profile data and render an image using the avatar_url from the cached response.
const UserProfile = ({ match }) =>
Fetch({
cache: state.users,
url: `https://api.github.com/users/${match.params.id}`,
done: actions.addUser,
view: (cache, key) => img({ src: cache[key].avatar_url }),
})
Route({ path: '/:id', render: UserProfile }),
FAQs
A component for fetching and caching data before rendering a view
The npm package hyperapp-fetch receives a total of 1 weekly downloads. As such, hyperapp-fetch popularity was classified as not popular.
We found that hyperapp-fetch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.