Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please include a summary of the change and which issue is fixed. Please also inc
## Checklist:

- [ ] All tests are passing
- [ ] Changeset added (`pnpm changeset`) if this changes what users get (code, types, published files)
- [ ] Type definitions, if updated, pass `types:check` and `pack:check`
- [ ] Benchmark performance (`pnpm bench`, CI job summary) has not significantly decreased
- [ ] Bundle size (`pnpm size`, CI job summary) has not been significantly impacted
24 changes: 14 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Before contributing, _please make sure the issue relates directly to this librar
We encourage pull requests concerning:

- React features not handled in this library
- Integrating updates from `fast-deep-equal` - This, unfortunately, now requires more manual work. Use the comment blocks in `index.js`
- Integrating updates from `fast-deep-equal`: this, unfortunately, now requires more manual work. Use the comment blocks in `index.js`
to figure out what to paste and where.
- Integrating tests from `fast-deep-equal` - Copy its `spec/` test files into `test/fixtures/fast-deep-equal/`
- Integrating tests from `fast-deep-equal`: copy its `spec/` test files into `test/fixtures/fast-deep-equal/`
and update the version in that directory's README. The `fast-deep-equal` npm package in `devDependencies` is one of
the [benchmark](#benchmarks) baselines.
- Bugs in this library
Expand All @@ -27,6 +27,18 @@ Pull requests that should be for [fast-deep-equal](https://github.com/epoberezki

## Development

**TL;DR:** after [setup](#setup), everything CI checks runs with:

```sh
# Format, lint, types, all tests, then the packed package
$ pnpm run check
# Benchmarks (a report, not a check)
$ pnpm run bench
```

The repo's conventions in brief (3.x rules, types, upstream comment blocks,
changesets) are in [`AGENTS.md`](./AGENTS.md), which AI coding agents read too.

### Setup

We develop on the Node.js version in [`.nvmrc`](./.nvmrc) (CI uses it too). With
Expand Down Expand Up @@ -86,14 +98,6 @@ with [knip](https://knip.dev) (`knip.jsonc` lists what it can't see on its own):
$ pnpm dlx knip
```

**TL; DR:** - Everything you normally need to run is aggregated into:

```sh
# Format, lint, types, all tests, then the packed package
$ pnpm run check
$ pnpm run bench
```

### Testing

We test with [Vitest](https://vitest.dev/). One set of specs, `test/*.spec.mjs`,
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![React Fast Compare — Formidable, We build the modern web](https://raw.githubusercontent.com/FormidableLabs/react-fast-compare/master/react-fast-compare-Hero.png)](https://formidable.com/open-source/)
[![React Fast Compare — Nearform](https://oss.nearform.com/api/banner.svg?badge=react-fast-compare&bg=2f8f83)](https://nearform.com/open-source/)

[![Downloads][downloads_img]][npm_site]
[![GH Actions Status][actions_img]][actions_site]
Expand All @@ -23,7 +23,7 @@ $ npm install react-fast-compare
- ES5 compatible; works in node.js (0.10+) and browsers (IE9+)
- deeply compares any value (besides objects with circular references)
- handles React-specific circular references, like elements
- checks equality Date and RegExp objects
- checks equality of Date and RegExp objects
- should be as fast as [fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) via a single unified library, and with added guardrails for circular references.
- small: under 660 bytes minified+gzipped

Expand Down Expand Up @@ -59,11 +59,11 @@ class AnotherExpensiveComponent extends React.Component {

Deep checks in `React.memo` or a `shouldComponentUpdate` should not be used blindly.
First, see if the default
[React.memo](https://reactjs.org/docs/react-api.html#reactmemo) or
[PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
[React.memo](https://react.dev/reference/react/memo) or
[PureComponent](https://react.dev/reference/react/PureComponent)
will work for you. If it won't (if you need deep checks), it's wise to make
sure you've correctly indentified the bottleneck in your application by
[profiling the performance](https://reactjs.org/docs/optimizing-performance.html#profiling-components-with-the-chrome-performance-tab).
sure you've correctly identified the bottleneck in your application by
[profiling the performance](https://react.dev/reference/react/Profiler).
After you've determined that you _do_ need deep equality checks and you've
identified the minimum number of places to apply them, then this library may
be for you!
Expand Down Expand Up @@ -92,7 +92,7 @@ the results to the job summary of each run.
- `react-fast-compare` has `try`/`catch` guardrails for stack overflows from undetected (non-React) circular references.
- `react-fast-compare` has a _single_ unified entry point for all uses. No matter what your target application is, `import equal from 'react-fast-compare'` just works. `fast-deep-equal` has multiple entry points for different use cases.

This version of `react-fast-compare` tracks `fast-deep-equal@3.1.1`.
This version of `react-fast-compare` tracks `fast-deep-equal@3.1.3`.

## Bundle Size

Expand All @@ -105,19 +105,19 @@ as they [do not mangle during minification](https://github.com/pastelsky/package

## License

[MIT](https://github.com/FormidableLabs/react-fast-compare/blob/readme/LICENSE)
[MIT](./LICENSE)

## Contributing

Please see our [contributions guide](./CONTRIBUTING.md).

## Maintenance Status

**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
**Active:** Nearform is actively working on this project, and we expect to continue work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.

[actions_img]: https://github.com/FormidableLabs/react-fast-compare/actions/workflows/ci.yml/badge.svg
[actions_site]: https://github.com/formidablelabs/react-fast-compare/actions/workflows/ci.yml
[npm_img]: https://badge.fury.io/js/react-fast-compare.svg
[npm_site]: http://badge.fury.io/js/react-fast-compare
[actions_site]: https://github.com/FormidableLabs/react-fast-compare/actions/workflows/ci.yml
[npm_img]: https://img.shields.io/npm/v/react-fast-compare.svg
[npm_site]: https://www.npmjs.com/package/react-fast-compare
[downloads_img]: https://img.shields.io/npm/dm/react-fast-compare.svg
[maintenance_img]: https://img.shields.io/badge/maintenance-active-flatgreen.svg
[maintenance_img]: https://img.shields.io/badge/maintenance-active-green.svg
Binary file removed react-fast-compare-Hero.png
Binary file not shown.
Loading