-
Notifications
You must be signed in to change notification settings - Fork 625
Fix grid caching #5200
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
Fix grid caching #5200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,8 @@ export default class Section<K, V> { | |
readonly #width: number; | ||
|
||
#direction: DIRECTION; | ||
#dirty: Set<Row<K, V>> = new Set(); | ||
#end: Edge<K, V>; | ||
#itemIds = new Set<string>(); | ||
#nextMap: WeakMap<ID, ID> = new WeakMap(); | ||
#previousMap: WeakMap<ID, ID> = new WeakMap(); | ||
#shown: Set<Row<K, V>> = new Set(); | ||
|
@@ -129,7 +129,6 @@ export default class Section<K, V> { | |
target, | ||
threshold, | ||
top, | ||
updater, | ||
zooming, | ||
}: { | ||
config: SpotlightConfig<K, V>; | ||
|
@@ -181,14 +180,8 @@ export default class Section<K, V> { | |
break; | ||
} | ||
|
||
if (this.#dirty.has(row) && !zooming && updater) { | ||
row.updateItems(updater); | ||
this.#dirty.delete(row); | ||
} | ||
|
||
row.show( | ||
this.#container, | ||
this.#dirty.has(row) && zooming, | ||
this.#direction === DIRECTION.FORWARD ? TOP : BOTTOM, | ||
zooming, | ||
config | ||
|
@@ -225,7 +218,6 @@ export default class Section<K, V> { | |
|
||
updateItems(updater: (id: ID) => void) { | ||
for (const row of this.#shown) row.updateItems(updater); | ||
for (const row of this.#rows) !this.#shown.has(row) && this.#dirty.add(row); | ||
} | ||
|
||
async first( | ||
|
@@ -308,7 +300,9 @@ export default class Section<K, V> { | |
|
||
renderer(() => { | ||
const { rows, remainder } = this.#tile( | ||
[...end.remainder, ...data.items], | ||
[...end.remainder, ...data.items].filter( | ||
(i) => !this.#itemIds.has(i.id.description) | ||
), | ||
this.#height, | ||
data.next === null, | ||
data.focus, | ||
|
@@ -350,6 +344,7 @@ export default class Section<K, V> { | |
edge: newEnd, | ||
width: this.#width, | ||
}); | ||
|
||
this.#end = this.#start; | ||
this.#start = newEnd; | ||
|
||
|
@@ -452,6 +447,10 @@ export default class Section<K, V> { | |
rowItems.reverse(); | ||
} | ||
|
||
for (const i of rowItems) { | ||
this.#itemIds.add(i.id.description); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these be getting removed when the row is destroyed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, good point There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, rows are only deleted/destroyed when the section is deleted/destroyed. Will leave a comment |
||
const row = new Row({ | ||
config: this.#config, | ||
dangle: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
SpotlightConfig interface needs zooming parameter in render method
The SpotlightConfig interface in
app/packages/spotlight/src/types.ts
needs to be updated to include thezooming
parameter in its render method signature, as it's being used inrow.ts
.app/packages/spotlight/src/types.ts
: Add zooming parameter to the render method definition in SpotlightConfig interface🔗 Analysis chain
Verify render method compatibility
The render method now uses the
zooming
parameter. Ensure all implementations ofSpotlightConfig.render
handle this parameter correctly.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 55
Script:
Length of output: 16575