Gathering detailed insights and metrics for json-react-layouts-data-loader
Gathering detailed insights and metrics for json-react-layouts-data-loader
Gathering detailed insights and metrics for json-react-layouts-data-loader
Gathering detailed insights and metrics for json-react-layouts-data-loader
JSON React layouts enables registration of components and layouts (called compositions) to open up the possibilities of pages where the layout is driven by data.
npm install json-react-layouts-data-loader
Typescript
Module System
Node Version
NPM Version
70.8
Supply Chain
95.9
Quality
74.8
Maintenance
100
Vulnerability
100
License
json-react-layouts-data-loader@5.0.1
Updated on Apr 12, 2024
json-react-layouts@4.1.0
Updated on Apr 12, 2024
json-react-layouts-data-loader@5.0.0
Updated on Apr 09, 2024
json-react-layouts@4.0.0
Updated on Apr 09, 2024
json-react-layouts-data-loader@4.0.1
Updated on Aug 02, 2021
json-react-layouts@3.0.1
Updated on Aug 02, 2021
TypeScript (99.18%)
JavaScript (0.82%)
Total Downloads
92,054
Last Day
2
Last Week
47
Last Month
123
Last Year
4,542
MIT License
33 Stars
191 Commits
1 Forks
5 Watchers
9 Branches
6 Contributors
Updated on Nov 05, 2024
Minified
Minified + Gzipped
Latest Version
5.0.1
Package Id
json-react-layouts-data-loader@5.0.1
Unpacked Size
149.59 kB
Size
26.34 kB
File Count
29
NPM Version
6.14.16
Node Version
12.22.12
Published on
Apr 12, 2024
Cumulative downloads
Total Downloads
Last Day
-33.3%
2
Compared to previous day
Last Week
840%
47
Compared to previous week
Last Month
-83.4%
123
Compared to previous month
Last Year
-50.8%
4,542
Compared to previous year
1
1
Component middleware for JSON React layouts which enables data loading via the React SSR Data Loader library.
1import { init } from 'json-react-layouts-data-loader' 2import { DataLoaderResources, DataProvider } from 'react-ssr-data-loader' 3 4interface MyServices { 5 // Put the services you want available to components 6} 7 8const resources = new DataLoaderResources<MyServices>() 9const { 10 getMiddleware, 11 createRegisterableComponentWithData, 12 createRegisterableCompositionWithData, 13} = init<MyServices>(resources) 14 15const layout = LayoutRegistration() 16 .registerComponents(registrar => 17 registrar 18 // Register your components, then register the component data loading middleware 19 .registerMiddleware(getMiddleware('component')), 20 ) 21 .registerCompositions(registrar => 22 registrar 23 // Register your compositions, then register the composition data loading middleware 24 .registerMiddleware(getMiddleware('composition')), 25 ) 26 27// Data-loading component. 28export const testComponentWithDataRegistration = createRegisterableComponentWithData( 29 'test-with-data', 30 { 31 // You provide this function to load the data 32 loadData: props => {}, 33 }, 34 (props, data) => { 35 if (!data.loaded) { 36 return <div>Loading...</div> 37 } 38 39 return <TestComponentWithData data={data.result} /> 40 }, 41) 42 43// Data-loading composition. 44const testCompositionWithDataRegistration = createRegisterableCompositionWithData<'main'>()( 45 'test-with-data', // Composition content areas ^^^^^^ 46 { 47 // You provide this function to load the data 48 loadData: props => {}, 49 }, 50 ({ main }, props, data) => { 51 // ^^^^ Receive content areas here. 52 if (!data.loaded) { 53 return <div>Loading...</div> 54 } 55 56 return ( 57 <> 58 <TestComponentWithData data={data.result} /> 59 {main} 60 </> 61 ) 62 }, 63)
If you reference global variables in your data load function the data will not be re-fetched when that variable changes. This is because the data loader assumes if the arguments are the same, the result of the load function will be the same as the current data and do nothing.
You can use the useRuntimeParams
function to merge additional varibles to the data loader props when it re-renders so it can fetch the updated data as expected. For example if you had state stored in redux.
React hooks are supported inside this function.
1import { init } from 'json-react-layouts-data-loader' 2import { DataLoaderResources, DataProvider } from 'react-ssr-data-loader' 3 4export const testComponentWithDataRegistration = createRegisterableComponentWithData( 5 'test-with-data', 6 { 7 getRuntimeParams: (props, services) => services.store.getState().myAdditionalState 8 // You provide this function to load the data 9 loadData: props => { 10 // Now the global state is visible to the data loader and will make up the cache key so changes to myAdditionalState will cause the data to be re-loaded 11 props.myAdditionalState 12 }, 13 }, 14 (props, data) => { 15 if (!data.loaded) { 16 return <div>Loading...</div> 17 } 18 19 return <TestComponentWithData data={data.result} /> 20 }, 21)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/3 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More