Skip to content

feat: replaced fast-deep-equal with fast-equals #893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 31, 2025
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
14 changes: 12 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"test:all": "jest"
},
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-equals": "^5.2.2",
"supercluster": "^8.0.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "./utils";

import { Cluster } from "../cluster";
import equal from "fast-deep-equal";
import { deepEqual } from "fast-equals";
import { MarkerUtils, Marker } from "../marker-utils";
import { assertNotNull } from "../utils";

Expand Down Expand Up @@ -74,7 +74,7 @@ export class GridAlgorithm extends AbstractViewportAlgorithm {
if (this.state.zoom >= this.maxZoom && newState.zoom >= this.maxZoom) {
// still at or beyond maxZoom, no change
} else {
changed = !equal(this.state, newState);
changed = !deepEqual(this.state, newState);
}

this.state = newState;
Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/supercluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { AbstractAlgorithm, AlgorithmInput, AlgorithmOutput } from "./core";
import SuperCluster, { ClusterFeature } from "supercluster";
import { MarkerUtils, Marker } from "../marker-utils";
import { Cluster } from "../cluster";
import equal from "fast-deep-equal";
import { deepEqual } from "fast-equals";
import { assertNotNull } from "../utils";

export type SuperClusterOptions = SuperCluster.Options<
Expand Down Expand Up @@ -57,7 +57,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {

const state = { zoom: zoom };

if (!equal(input.markers, this.markers)) {
if (!deepEqual(input.markers, this.markers)) {
changed = true;
// TODO use proxy to avoid copy?
this.markers = [...input.markers];
Expand All @@ -79,7 +79,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {

if (!changed) {
if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) {
changed = !equal(this.state, state);
changed = !deepEqual(this.state, state);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/superviewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import SuperCluster, { ClusterFeature } from "supercluster";
import { MarkerUtils, Marker } from "../marker-utils";
import { Cluster } from "../cluster";
import { getPaddedViewport } from "./utils";
import equal from "fast-deep-equal";
import { deepEqual } from "fast-equals";
import { assertNotNull } from "../utils";

export interface SuperClusterViewportOptions
Expand Down Expand Up @@ -71,8 +71,8 @@ export class SuperClusterViewportAlgorithm extends AbstractViewportAlgorithm {
public calculate(input: AlgorithmInput): AlgorithmOutput {
const state = this.getViewportState(input);

let changed = !equal(this.state, state);
if (!equal(input.markers, this.markers)) {
let changed = !deepEqual(this.state, state);
if (!deepEqual(input.markers, this.markers)) {
changed = true;
// TODO use proxy to avoid copy?
this.markers = [...input.markers];
Expand Down
Loading