-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve the rendering performance (#58)
* fix: improve performance by only rendering ContextMenuButton when hovered or selected * fix: improve performance by memoizing the paths passed to child components
- Loading branch information
Showing
6 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
|
@@ -75,7 +75,6 @@ | |
|
||
.insert-area { | ||
&.selected { | ||
display: flex; | ||
z-index: 2; | ||
outline-color: $insert-area-background; | ||
} | ||
|
This file contains 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 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 |
---|---|---|
@@ -1,17 +1,33 @@ | ||
import assert from 'assert' | ||
import { stringifyPath } from './pathUtils.js' | ||
import { notStrictEqual, strictEqual } from 'assert' | ||
import { createMemoizePath, stringifyPath } from './pathUtils.js' | ||
|
||
describe('pathUtils', () => { | ||
it('stringifyPath', () => { | ||
assert.strictEqual(stringifyPath([]), '') | ||
assert.strictEqual(stringifyPath(['']), '[""]') | ||
assert.strictEqual(stringifyPath(['foo']), '.foo') | ||
assert.strictEqual(stringifyPath(['foo', 'bar']), '.foo.bar') | ||
assert.strictEqual(stringifyPath(['foo', 2]), '.foo[2]') | ||
assert.strictEqual(stringifyPath(['foo', 2, 'bar']), '.foo[2].bar') | ||
assert.strictEqual(stringifyPath(['foo', 2, 'bar_baz']), '.foo[2].bar_baz') | ||
assert.strictEqual(stringifyPath([2]), '[2]') | ||
assert.strictEqual(stringifyPath(['foo', 'prop-with-hyphens']), '.foo["prop-with-hyphens"]') | ||
assert.strictEqual(stringifyPath(['foo', 'prop with spaces']), '.foo["prop with spaces"]') | ||
strictEqual(stringifyPath([]), '') | ||
strictEqual(stringifyPath(['']), '[""]') | ||
strictEqual(stringifyPath(['foo']), '.foo') | ||
strictEqual(stringifyPath(['foo', 'bar']), '.foo.bar') | ||
strictEqual(stringifyPath(['foo', 2]), '.foo[2]') | ||
strictEqual(stringifyPath(['foo', 2, 'bar']), '.foo[2].bar') | ||
strictEqual(stringifyPath(['foo', 2, 'bar_baz']), '.foo[2].bar_baz') | ||
strictEqual(stringifyPath([2]), '[2]') | ||
strictEqual(stringifyPath(['foo', 'prop-with-hyphens']), '.foo["prop-with-hyphens"]') | ||
strictEqual(stringifyPath(['foo', 'prop with spaces']), '.foo["prop with spaces"]') | ||
}) | ||
|
||
it('createMemoizePath', () => { | ||
const memoizePath = createMemoizePath() | ||
|
||
const path1 = ['a', 'b'] | ||
strictEqual(memoizePath(path1), path1) | ||
|
||
const path2 = path1.slice(0) | ||
strictEqual(memoizePath(path2), path1) | ||
|
||
const memoizePath2 = createMemoizePath() | ||
const path3 = path1.slice(0) | ||
strictEqual(memoizePath2(path3), path3) // must NOT be path1, must be isolated from memoizePath | ||
|
||
notStrictEqual(path1, path1.slice(0)) // just to validate that strictEqual works the way I think | ||
}) | ||
}) |