{"_id":"solid-swr-store","_rev":"4232188","name":"solid-swr-store","description":"SolidJS bindings for swr-store","dist-tags":{"latest":"0.10.7"},"maintainers":[{"name":"lxsmnsyc","email":""}],"time":{"modified":"2026-03-23T00:40:45.000Z","created":"2022-01-18T12:57:22.342Z","0.10.7":"2023-02-21T13:59:46.569Z","0.10.6":"2023-02-21T12:36:17.892Z","0.10.5":"2023-02-13T16:19:59.355Z","0.10.4":"2022-07-28T12:44:05.122Z","0.10.3":"2022-07-20T07:19:29.732Z","0.10.2":"2022-03-05T06:26:14.606Z","0.10.0":"2022-01-18T12:57:22.342Z"},"users":{},"author":{"name":"Alexis Munsayac"},"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"versions":{"0.10.7":{"version":"0.10.7","type":"module","types":"./dist/types/index.d.ts","main":"./dist/cjs/production/index.cjs","module":"./dist/esm/production/index.mjs","exports":{".":{"development":{"require":"./dist/cjs/development/index.cjs","import":"./dist/esm/development/index.mjs"},"require":"./dist/cjs/production/index.cjs","import":"./dist/esm/production/index.mjs","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/node":"^18.13.0","eslint":"^8.33.0","eslint-config-lxsmnsyc":"^0.4.8","pridepack":"^2.4.0","solid-js":"^1.6.2","swr-store":"0.10.6","tslib":"^2.5.0","typescript":"^4.9.5"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.10"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"typesVersions":{"*":{}},"gitHead":"892284d83df4494fab14e78623910e5008bf98e7","_id":"solid-swr-store@0.10.7","_nodeVersion":"19.6.0","_npmVersion":"lerna/6.5.1/node@v19.6.0+x64 (win32)","dist":{"shasum":"9511308f01250a1509efbfaad5b481be7517e436","size":5232,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.7.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.7_1676987986382_0.4029847359499845"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-21T13:59:46.569Z","publish_time":1676987986569,"_cnpm_publish_time":1676987986569},"0.10.6":{"version":"0.10.6","type":"module","types":"./dist/types/index.d.ts","main":"./dist/cjs/production/index.cjs","module":"./dist/esm/production/index.mjs","exports":{".":{"development":{"require":"./dist/cjs/development/index.cjs","import":"./dist/esm/development/index.mjs"},"require":"./dist/cjs/production/index.cjs","import":"./dist/esm/production/index.mjs","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/node":"^18.13.0","eslint":"^8.33.0","eslint-config-lxsmnsyc":"^0.4.8","pridepack":"^2.4.0","solid-js":"^1.6.2","swr-store":"0.10.6","tslib":"^2.5.0","typescript":"^4.9.5"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.10"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"typesVersions":{"*":{}},"gitHead":"d13357008c132592ebf51676f02fd83fc5103fb4","_id":"solid-swr-store@0.10.6","_nodeVersion":"19.6.0","_npmVersion":"lerna/6.5.1/node@v19.6.0+x64 (win32)","dist":{"shasum":"a2e8a8ad8a5bf0d5cc0becf2f47e6337a4829cce","size":5230,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.6.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.6_1676982977715_0.6728777053701278"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-21T12:36:17.892Z","publish_time":1676982977892,"_cnpm_publish_time":1676982977892},"0.10.5":{"version":"0.10.5","type":"module","types":"./dist/types/index.d.ts","main":"./dist/cjs/production/index.cjs","module":"./dist/esm/production/index.mjs","exports":{".":{"development":{"require":"./dist/cjs/development/index.cjs","import":"./dist/esm/development/index.mjs"},"require":"./dist/cjs/production/index.cjs","import":"./dist/esm/production/index.mjs","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/node":"^18.13.0","eslint":"^8.33.0","eslint-config-lxsmnsyc":"^0.4.8","pridepack":"^2.4.0","solid-js":"^1.6.2","swr-store":"0.10.5","tslib":"^2.5.0","typescript":"^4.9.5"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.10"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"typesVersions":{"*":{}},"gitHead":"f47a6faa5bc4cce9e61e607db88c97a879d6de2f","_id":"solid-swr-store@0.10.5","_nodeVersion":"19.5.0","_npmVersion":"lerna/6.1.0/node@v19.5.0+x64 (win32)","dist":{"shasum":"59ac3fe26b29591ba17c0fc0e4a485b58818ead6","size":5094,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.5.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.5_1676305199106_0.5693099031942985"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-13T16:19:59.355Z","publish_time":1676305199355,"_cnpm_publish_time":1676305199355},"0.10.4":{"version":"0.10.4","types":"dist/types/index.d.ts","main":"dist/cjs/production/index.js","module":"dist/esm/production/index.js","exports":{".":{"development":{"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js"},"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/jest":"^27.0.1","@types/node":"^17.0.9","eslint":"^8.20.0","eslint-config-lxsmnsyc":"^0.4.8","pridepack":"^2.1.2","solid-js":"^1.4.7","swr-store":"0.10.4","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.9"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./dist/types/index.d.ts"]}},"gitHead":"ae7ea141fa647ad77cf76e701769d73bfe40aad7","_id":"solid-swr-store@0.10.4","_nodeVersion":"16.8.0","_npmVersion":"lerna/5.1.8/node@v16.8.0+x64 (win32)","dist":{"shasum":"4b964e2911787cc249483cf67b1f8042de043f39","size":5078,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.4.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.4_1659012244954_0.151667385635609"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-07-28T13:06:27.563Z","publish_time":1659012245122,"_cnpm_publish_time":1659012245122},"0.10.3":{"version":"0.10.3","types":"dist/types/index.d.ts","main":"dist/cjs/production/index.js","module":"dist/esm/production/index.js","exports":{".":{"development":{"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js"},"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/jest":"^27.0.1","@types/node":"^17.0.9","eslint":"^8.19.0","eslint-config-lxsmnsyc":"^0.4.7","pridepack":"^2.0.1","solid-js":"^1.4.7","swr-store":"0.10.3","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.9"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./dist/types/index.d.ts"]}},"gitHead":"b55bba89e7149b77aab158cf2693ae912ad0b642","_id":"solid-swr-store@0.10.3","_nodeVersion":"16.8.0","_npmVersion":"lerna/5.1.8/node@v16.8.0+x64 (win32)","dist":{"shasum":"577299b53ecfe1914a84220ef9153fcd4eb5b162","size":5544,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.3.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.3_1658301569346_0.5738607476535356"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-07-20T07:40:09.068Z","publish_time":1658301569732,"_cnpm_publish_time":1658301569732},"0.10.2":{"version":"0.10.2","types":"dist/types/index.d.ts","main":"dist/cjs/production/index.js","module":"dist/esm/production/index.js","exports":{".":{"development":{"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js"},"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"},"./dev":{"production":{"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js"},"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js","types":"./dist/types/index.d.ts"},"./esm":{"development":"./dist/esm/development/index.js","production":"./dist/esm/production/index.js","default":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"},"./cjs":{"development":"./dist/cjs/development/index.js","production":"./dist/cjs/production/index.js","default":"./dist/cjs/production/index.js","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/jest":"^27.0.1","@types/node":"^17.0.9","eslint":"^8.7.0","eslint-config-lxsmnsyc":"^0.4.0","pridepack":"^1.0.4","solid-js":"^1.3.10","swr-store":"0.10.2","tslib":"^2.3.1","typescript":"^4.5.4"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.9"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"SolidJS bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"gitHead":"44bc6e41e3f4f3c86f2e2d13cead4631acab312b","_id":"solid-swr-store@0.10.2","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (win32)","dist":{"shasum":"2f86795c78037e392e952b7fea52b6c0f1b6ddd2","size":6462,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.2.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.2_1646461574440_0.5168114982489411"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-05T06:26:17.888Z","publish_time":1646461574606,"_cnpm_publish_time":1646461574606},"0.10.0":{"version":"0.10.0","types":"dist/types/index.d.ts","main":"dist/cjs/production/index.js","module":"dist/esm/production/index.js","exports":{".":{"development":{"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js"},"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"},"./dev":{"production":{"require":"./dist/cjs/production/index.js","import":"./dist/esm/production/index.js"},"require":"./dist/cjs/development/index.js","import":"./dist/esm/development/index.js","types":"./dist/types/index.d.ts"},"./esm":{"development":"./dist/esm/development/index.js","production":"./dist/esm/production/index.js","default":"./dist/esm/production/index.js","types":"./dist/types/index.d.ts"},"./cjs":{"development":"./dist/cjs/development/index.js","production":"./dist/cjs/production/index.js","default":"./dist/cjs/production/index.js","types":"./dist/types/index.d.ts"}},"engines":{"node":">=10"},"license":"MIT","keywords":["pridepack"],"name":"solid-swr-store","devDependencies":{"@types/jest":"^27.0.1","@types/node":"^17.0.9","eslint":"^8.7.0","eslint-config-lxsmnsyc":"^0.4.0","pridepack":"^1.0.4","solid-js":"^1.3.3","swr-store":"0.10.0","tslib":"^2.3.1","typescript":"^4.5.4"},"peerDependencies":{"solid-js":"^1.2","swr-store":"^0.9"},"scripts":{"prepublish":"pridepack clean && pridepack build","build":"pridepack build","type-check":"pridepack check","lint":"pridepack lint","test":"pridepack test --passWithNoTests","clean":"pridepack clean","watch":"pridepack watch"},"description":"React bindings for swr-store","author":{"name":"Alexis Munsayac"},"private":false,"repository":{"url":"git+https://github.com/lxsmnsyc/swr-store.git","type":"git"},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"publishConfig":{"access":"public"},"gitHead":"d385b6e868679581b67c7f9d6ee40c353053fe4a","_id":"solid-swr-store@0.10.0","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (win32)","dist":{"shasum":"943ae242785871514a0528cf69e0e982573611ab","size":3451,"noattachment":false,"key":"/solid-swr-store/-/solid-swr-store-0.10.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/solid-swr-store/download/solid-swr-store-0.10.0.tgz"},"_npmUser":{"name":"lxsmnsyc","email":"alexis.munsayac@gmail.com"},"directories":{},"maintainers":[{"name":"lxsmnsyc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/solid-swr-store_0.10.0_1642510642057_0.44055123248817596"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-18T12:57:32.969Z","publish_time":1642510642342,"_cnpm_publish_time":1642510642342}},"readme":"# solid-swr-store\n\n> SolidJS bindings for `swr-store`\n\n[![NPM](https://img.shields.io/npm/v/solid-swr-store.svg)](https://www.npmjs.com/package/solid-swr-store) [![JavaScript Style Guide](https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?style=flat-square&logo=codesandbox)](https://codesandbox.io/s/github/LXSMNSYC/swr-store/tree/main/examples/solid-swr-store)\n\n## Install\n\n```bash\nnpm install --save swr-store solid-swr-store\n```\n\n```bash\nyarn add swr-store solid-swr-store\n```\n\n## Usage\n\n```tsx\nimport { Suspense } from 'solid-js';\nimport { createSWRStore } from 'swr-store';\nimport { useSWRStore, useSWRStoreSuspenselesss } from 'solid-swr-store';\n\nconst API = 'https://dog.ceo/api/breed/';\nconst API_SUFFIX = '/images/random';\n\ninterface APIResult {\n  message: string;\n  status: string;\n}\n\nconst dogAPI = createSWRStore<APIResult, [string]>({\n  key: (breed: string) => breed,\n  get: async (breed: string) => {\n    const response = await fetch(`${API}${breed}${API_SUFFIX}`);\n    return (await response.json()) as APIResult;\n  },\n  revalidateOnFocus: true,\n  revalidateOnNetwork: true,\n});\n\nfunction DogImage(): JSX.Element {\n  const data = useSWRStore(dogAPI, ['shiba']);\n\n  return <img src={data().message} alt={data().message} />;\n}\n\nfunction DogImageSuspenseless(): JSX.Element {\n  const data = useSWRStoreSuspenseless(dogAPI, ['shiba']);\n\n  return () => {\n    const current = data();\n\n    if (current.status === 'pending') {\n      return <h1>Loading...</h1>;\n    }\n    if (current.status === 'failure') {\n      return <h1>Something went wrong.</h1>\n    }\n    return <img src={current.data.message} alt={current.data.message} />;\n  };\n}\n\nfunction Trigger(): JSX.Element {\n  return (\n    <button\n      type=\"button\"\n      onClick={() => {\n        dogAPI.trigger(['shiba']);\n      }}\n    >\n      Trigger\n    </button>\n  );\n}\n\nexport default function App(): JSX.Element {\n  return (\n    <>\n      <Trigger />\n      <div>\n        <Suspense fallback={<h1>Loading...</h1>}>\n          <DogImage />\n        </Suspense>\n        <DogImageSuspenseless />\n      </div>\n    </>\n  );\n}\n```\n\n## API\n\n### `useSWRStore(store, args, options)`\n\nSubscribes to an SWR store, passing `args`, which are received by the corresponding store for data-fetching and cache updates.\n\n`options` has the following properties:\n\n- `initialData`: Allows lazy hydration when reading the store. If the store does not have cache, `initialData` hydrates the cache and attempts a revalidation. If no `initialData` is provided, defaults to store's `options.initialData`.\n- `shouldRevalidate`: If `true`, goes through the revalidation process when reading through the cache. Defaults to `true`.\n\n### `useSWRStoreSuspenseless(store, args, options)`\n\nHas the same API as `useSWRStore` except that it doesn't suspend the reading component.\n\n## License\n\nMIT © [lxsmnsyc](https://github.com/lxsmnsyc)\n","_attachments":{},"homepage":"https://github.com/lxsmnsyc/swr-store/tree/main/packages/solid-swr-store","bugs":{"url":"https://github.com/lxsmnsyc/swr-store/issues"},"license":"MIT"}