Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@react-facet/deferred-mount
Advanced tools
React Facet is a state management for performant game UIs. For more information on how to use this package check the official documentation available at https://react-facet.mojang.com/.
This package allows you to defer the mounting of a component to the next frame. By wrapping components on a big list you can keep the frame time low while everything is mounted.
When the DeferredMountProvider
is used, it requires that there is at least one descendent as a DeferredMount
or DeferredMountWithCallback
, otherwise it will wait forever as deferring
.
In the example below it will mount:
First
First
and Second
First
, Second
and Third
The useIsDeferring
hook allows to check what is the status of the deferred mounting (by returning a Facet) so we can, for example, show a spinner.
const SampleComponent = () => {
const isDeferringFacet = useIsDeferring()
return (
<>
<fast-text text={useFacetMap((isDeferring) => (isDeferring ? 'deferring' : 'done'), [], [isDeferringFacet])} />
<DeferredMount>
<div>First</div>
</DeferredMount>
<DeferredMount>
<div>Second</div>
</DeferredMount>
<DeferredMount>
<div>Third</div>
</DeferredMount>
</>
)
}
render(
<DeferredMountProvider frameTimeBudget={16}>
<SampleComponent />
</DeferredMountProvider>,
document.getElementById('root'),
)
The frameTimeBudget
prop allows the tweaking of how much time the library has available to do work on a given frame (by default it targets 60fps).
Some components may need to wait some time before they can be considered fully rendered (for example if they are fetching data). For these cases you should use DeferredMountWithCallback
with the useNotifyMountComplete
hook.
const DelayedComponent = () => {
const notifyMountComplete = useNotifyMountComplete()
const [data, setData] = useState()
useEffect(() => {
fetch('mock-api').then((data) => {
setData(data)
notifyMountComplete()
})
}, [notifyMountComplete])
return <div>{data}</div>
}
render(
<DeferredMountProvider>
<DeferredMountWithCallback>
<DelayedComponent />
</DeferredMountWithCallback>
</DeferredMountProvider>,
document.getElementById('root'),
)
FAQs
Unknown package
The npm package @react-facet/deferred-mount receives a total of 28,871 weekly downloads. As such, @react-facet/deferred-mount popularity was classified as popular.
We found that @react-facet/deferred-mount demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.