-
Notifications
You must be signed in to change notification settings - Fork 0
Add memoization for invoking callbacks #110
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
forman
merged 16 commits into
main
from
yogesh-xcube-viewer-490-fix-unnecessary-state-changes
Mar 15, 2025
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
54d474c
Add memoization for invoking callbacks
b-yogesh 9cda8bd
Merge branch 'main' into yogesh-xcube-viewer-490-fix-unnecessary-stat…
b-yogesh 164dc48
Revert
b-yogesh e6f239c
Add fast-memoize
b-yogesh 0a75265
implement memoizing and avoid invoking callbacks when not required
b-yogesh 7bc63f1
add tests
b-yogesh 2f8afc1
update tests
b-yogesh 650bbf7
update store and memoized function
b-yogesh c0fa4c2
update CHANGES.md
b-yogesh 8c02307
use shallow comparison and some refactoring
b-yogesh 70452a6
increase test coverage
b-yogesh b78cce9
update based on reviwers comments
b-yogesh c95671e
Update chartlets.js/CHANGES.md
b-yogesh 3fab4e4
small refactor
b-yogesh 86809c8
update
b-yogesh 7a49490
update based on reviewers comments
b-yogesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { shallowEqualArrays } from "@/utils/compare"; | ||
|
|
||
| describe("Test shallowEqualArrays()", () => { | ||
| const arr_a: string[] = ["a", "b", "c"]; | ||
| const arr_b: string[] = ["a", "b", "c"]; | ||
| const arr_c: string[] = ["a", "b", "d"]; | ||
| const arr_d: string[] = []; | ||
| const arr_e: string[] = ["a", "b", "c", "d"]; | ||
| const arr_f: (string | null)[] = ["a", "b", "c", null]; | ||
| const arr_g: (string | null)[] = ["a", "b", "c", null]; | ||
| const arr_h = [1, [1, 2, 3], [4, 5, 6]]; | ||
| const arr_i = [1, [1, 2, 3], [4, 5, 6]]; | ||
| const arr_j: (number | string | null)[] = [1, 2, "c", null]; | ||
| const arr_k: (number | string | null)[] = [1, 3, "c", null]; | ||
| const arr_l: (number | string | null)[] = [1, 2, "c", null]; | ||
| const arr_m: number[] = [1, 2]; | ||
| const arr_n: number[] = [1, 2]; | ||
| const arr_o: null[] = [null]; | ||
| const arr_p: null[] = [null]; | ||
| const arr_q: null[] = []; | ||
| it("works", () => { | ||
| expect(shallowEqualArrays(arr_a, arr_b)).toBe(true); | ||
| expect(shallowEqualArrays(arr_a, arr_c)).toBe(false); | ||
| expect(shallowEqualArrays(arr_a, arr_d)).toBe(false); | ||
| expect(shallowEqualArrays(arr_a, arr_e)).toBe(false); | ||
| expect(shallowEqualArrays(arr_e, arr_c)).toBe(false); | ||
| expect(shallowEqualArrays(arr_f, arr_g)).toBe(true); | ||
| expect(shallowEqualArrays(arr_h, arr_i)).toBe(false); | ||
| expect(shallowEqualArrays(arr_j, arr_k)).toBe(false); | ||
| expect(shallowEqualArrays(arr_j, arr_l)).toBe(true); | ||
| expect(shallowEqualArrays(arr_m, arr_n)).toBe(true); | ||
| expect(shallowEqualArrays(arr_m, arr_l)).toBe(false); | ||
| expect(shallowEqualArrays(arr_o, arr_p)).toBe(true); | ||
| expect(shallowEqualArrays(arr_p, arr_q)).toBe(false); | ||
| expect(shallowEqualArrays(arr_p)).toBe(false); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.