GithubHelp home page GithubHelp logo

michaelhettmer / react-hooks-use-previous Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 1.0 17.09 MB

Strongly typed and well tested React Hooks to store and retrieve previous values from any component property.

License: MIT License

JavaScript 7.36% TypeScript 92.64%

react-hooks-use-previous's People

Contributors

allcontributors[bot] avatar chrismilson avatar michaelhettmer avatar renovate-bot avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

chrismilson

react-hooks-use-previous's Issues

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): replace dependency npm-run-all with npm-run-all2 5.0.0
  • chore(deps): update codecov orb to v3.3.0
  • chore(deps): update dependency prettier to v2.8.8
  • chore(deps): update dependency typescript to v4.9.5
  • chore(deps): update typescript-eslint monorepo to v5.62.0 (minor) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore(deps): update codecov orb to v4
  • chore(deps): update commitlint monorepo to v19 (major) (@commitlint/cli, @commitlint/config-conventional)
  • chore(deps): update dependency @testing-library/react-hooks to v8
  • chore(deps): update dependency eslint-config-prettier to v9
  • chore(deps): update dependency eslint-plugin-prettier to v5
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency jest-junit to v16
  • chore(deps): update dependency jest-mock-console to v2
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency typescript to v5
  • chore(deps): update jest monorepo to v29 (major) (@types/jest, jest, ts-jest)
  • chore(deps): update react monorepo to v18 (major) (@types/react, react, react-test-renderer)
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • πŸ” Create all rate-limited PRs at once πŸ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

circleci
.circleci/config.yml
  • codecov 3.2.2
  • circleci/node 12.22.7
  • circleci/node 12.22.7
  • circleci/node 12.22.7
  • circleci/node 12.22.7
  • circleci/node 12.22.7
  • circleci/node 12.22.7
  • circleci/node 12.22.7
npm
package.json
  • @commitlint/cli 11.0.0
  • @commitlint/config-conventional 11.0.0
  • @semantic-release/changelog 5.0.1
  • @semantic-release/git 9.0.1
  • @testing-library/react-hooks 7.0.2
  • @types/jest 27.4.0
  • @types/react 17.0.39
  • @typescript-eslint/eslint-plugin 5.11.0
  • @typescript-eslint/parser 5.11.0
  • chokidar-cli 3.0.0
  • commitlint-circle 1.0.0
  • dot-json 1.2.2
  • eslint 8.8.0
  • eslint-config-prettier 7.2.0
  • eslint-plugin-json 3.1.0
  • eslint-plugin-prettier 4.0.0
  • eslint-plugin-react-hooks 4.3.0
  • husky 4.3.8
  • jest 27.5.1
  • jest-junit 13.0.0
  • jest-mock-console 1.2.3
  • lint-staged 12.3.4
  • nodegit 0.27.0
  • npm-run-all 4.1.5
  • prettier 2.5.1
  • react 17.0.2
  • react-test-renderer 17.0.2
  • semantic-release 17.4.7
  • shelljs 0.8.5
  • ts-jest 27.1.3
  • typescript 4.5.5
  • react >=16.8.0
  • node >=8.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Fails on empty update

Bug Description
The hook will return a value that I would not consider to be the previous value of a supplied prop.

To Reproduce
run the test

it('should not update on rerender if prop is unchanged', () => {
  const { result, rerender } = renderHook(() => usePrevious('current', 'initial'));

  rerender();

  expect(result.current).not.toBe('current');
});

Suggested Fix
Instead of using useEffect, use a simple if statement to check for update (similarly to how useEffect checks its own array, effectively cutting out the middleman)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.