{"id":15603500,"url":"https://github.com/codemeasandwich/red-ux","last_synced_at":"2026-04-29T18:33:32.355Z","repository":{"id":57349496,"uuid":"96239037","full_name":"codemeasandwich/red-ux","owner":"codemeasandwich","description":"Better ux for redux","archived":false,"fork":false,"pushed_at":"2018-04-11T13:16:56.000Z","size":18,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T16:57:27.489Z","etag":null,"topics":["optimization","performance","redux","reselect"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemeasandwich.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-04T17:05:35.000Z","updated_at":"2021-10-08T16:56:59.000Z","dependencies_parsed_at":"2022-09-13T11:40:13.744Z","dependency_job_id":null,"html_url":"https://github.com/codemeasandwich/red-ux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codemeasandwich/red-ux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemeasandwich%2Fred-ux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemeasandwich%2Fred-ux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemeasandwich%2Fred-ux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemeasandwich%2Fred-ux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemeasandwich","download_url":"https://codeload.github.com/codemeasandwich/red-ux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemeasandwich%2Fred-ux/sbom","scorecard":{"id":296760,"data":{"date":"2025-08-11","repo":{"name":"github.com/codemeasandwich/red-ux","commit":"15b7688fc7c2d5c5d7caf570a33c13570c106205"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T19:44:31.840Z","repository_id":57349496,"created_at":"2025-08-17T19:44:31.840Z","updated_at":"2025-08-17T19:44:31.840Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["optimization","performance","redux","reselect"],"created_at":"2024-10-03T03:03:40.156Z","updated_at":"2026-04-29T18:33:32.341Z","avatar_url":"https://github.com/codemeasandwich.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# red-ux\n\n## performance utilities for progressive web apps.\n\ntake your user experience out of the red\n\n[![npm version](https://badge.fury.io/js/red-ux.svg)](https://www.npmjs.com/package/red-ux) [![coverage](https://img.shields.io/codecov/c/github/codemeasandwich/red-ux.svg)](https://codecov.io/gh/codemeasandwich/red-ux) [![Build](https://circleci.com/gh/codemeasandwich/red-ux.png)](https://circleci.com/gh/codemeasandwich/red-ux)\n\n---\n\n* React:\n    * [shouldUpdate](#react-reduce-unneeded-re-rendering-with-shouldupdate) - reduce unneeded re-rendering\n* Redux:\n    * [genSelectState](#redux-result-caching-with-genselectstate) - result caching\n\n---\n\n## React: Reduce unneeded re-rendering with `shouldUpdate`\n\n```JS\nimport React, {Component} from 'react';\nimport { shouldUpdate } from 'red-ux'\n\nexport class List extends Component {\n\n  shouldComponentUpdate(nextProps, nextState){\n    return shouldUpdate(nextProps, nextState);\n  }\n\n  render() {\n    return (\n      \u003cul\u003e{\n        this.props.data.map(({name,id}) =\u003e \u003cli key={id}\u003e{name}\u003c/li\u003e)\n      }\u003c/ul\u003e)\n    }\n}\n```\n\n---\n\n## Redux: Result caching with `genSelectState`\n\n`genSelectState` uses [Reselect](https://github.com/reactjs/reselect) under the hood.\n\nThis function will let you wrap computationally expensive logic.\n\nExample; using React \u0026 Redux.\n\n* Without `genSelectState`\n\n```JS\nimport React, {Component} from 'react';\nimport { connect } from 'react-redux';\n\nexport class List extends Component {\n\n  render() {\n\n    const posts = this.props.posts.map( post =\u003e ({ id: post.uid, name:post.userName }) )\n\n    return (\n      \u003cul\u003e\u003cli\u003e{this.props.user.name} List\u003c/li\u003e{\n        posts.map(post =\u003e \u003cli key={post.id}\u003e{post.name}\u003c/li\u003e)\n      }\u003c/ul\u003e)\n    }\n}\n\nconst map_state_to_props = (state)=\u003e({\n  user  : state.user,\n  posts : state.posts\n}}\n\nexport default connect(map_state_to_props)(List);\n```\n\n* With `genSelectState`\n\n```JS\nimport React, {Component} from 'react';\nimport { connect } from 'react-redux';\nimport { genSelectState } from 'red-ux'\n\nexport class List extends Component {\n\n  render() {\n\n    return (\n      \u003cul\u003e\u003cli\u003e{this.props.user.name} List\u003c/li\u003e{\n        this.props.posts.map(post =\u003e \u003cli key={post.id}\u003e{post.name}\u003c/li\u003e)\n      }\u003c/ul\u003e)\n    }\n}\n\nconst map_state_to_props = (state)=\u003e({\n  user  : state.user,\n  posts : state.posts\n}}\n\nconst works = {\n  posts : posts =\u003e posts.map( post =\u003e ({ id: post.uid, name:post.userName }))\n}\n\nexport default connect(genSelectState( map_state_to_props, works ))(List);\n```\n\nNow the transformation will only happen once on each if the reference passed in was the same.\nThis means that the posts transformation will happen on the first call and will return the same calculated value is the posts have not changed.\n\n### An **alternative api** is available that more closely follows *reselect*\n\n```JS\nimport React, {Component} from 'react';\nimport { connect } from 'react-redux';\nimport { genSelectState } from 'red-ux'\n\nexport class List extends Component {\n\n  render() {\n\n    return (\n      \u003cul\u003e\u003cli\u003e{this.props.user.name} List\u003c/li\u003e{\n        this.props.posts.map(post =\u003e \u003cli key={post.id}\u003e{post.name}\u003c/li\u003e)\n      }\u003c/ul\u003e)\n    }\n}\n\nconst selecters = {\n  user  : state =\u003e state.user\n  posts : state =\u003e state.posts\n}\n\nconst works = {\n  posts : posts =\u003e posts.map( post =\u003e ({ id: post.uid, name:post.userName }))\n}\n\nexport default connect(genSelectState( selecter, works ))(List);\n```\n\nYou pass an `Object` as the first argument to `genSelectState` that maps the to select functions\n\n - If you have multiple pieces of state. **Pass an Array**\n\n```JS\nconst map_state_to_props = (state)=\u003e({\n  user  : state.user,\n  posts : [state.posts.a,\n           state.posts.b]\n}}\nconst works = {\n  posts : (a,b) =\u003e posts.map( post =\u003e ({ id: post.uid, name:post.userName }))\n}\n```\nand\n\n```JS\nconst selecters = {\n  user  : state =\u003e state.user\n  posts : [state =\u003e state.posts.a,\n           state =\u003e state.posts.b]\n}\n\nconst works = {\n  posts : (a,b) =\u003e posts.map( post =\u003e ({ id: post.uid, name:post.userName }))\n}\n```\n\n**📌 Note:** As an optimization. The works object will has it's properties wrapped. So feel free to call works properties after the fact, knowing your getting optimized results.\n\n```JS\nconst works = {\n  foo : (a) =\u003e stuff(a),\n  bar : (a,b) =\u003e works.foo(a) + b,\n  cat : (a,b) =\u003e works.bar(a,b) + 1000,\n}\n```\n\n`works.bar` will only be executed once, even though its referenced twice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemeasandwich%2Fred-ux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemeasandwich%2Fred-ux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemeasandwich%2Fred-ux/lists"}