Slight changes to the CacheClient interface#253
Merged
Conversation
…st object - this makes it easier to build cache clients that are more flexible, which is nice for scatterbrain, as it is often the case that we rebuild a shader to bind different vertex buffers, but we'd like to keep using the same cache-client, as almost all the data is already there...
…either webGL or WebGPU easily)
froyo-np
commented
May 5, 2026
|
|
||
| export type ClientSpec<Item, ItemContent extends Record<string, Cacheable>> = { | ||
| isValue: (v: Record<string, Cacheable | undefined>) => v is ItemContent; | ||
| isValue: (v: Record<string, Cacheable | undefined>, item: Item) => v is ItemContent; |
Collaborator
Author
There was a problem hiding this comment.
this is the api change - its non-breaking. All prior cache-clients that pass an isValue method that ignores the new argument are valid, will work at runtime, and will pass typechecking still.
froyo-np
commented
May 5, 2026
|
|
||
| type Content<V extends Cacheable> = Record<string, V> | ||
|
|
||
| export function buildScatterbrainCacheClient<V extends Cacheable>( |
Collaborator
Author
There was a problem hiding this comment.
nearly identical to the version that has been deleted from ./renderer.ts - this version is simply slightly more generic.
it does not need to know about regl, nor does it rely on a closure over the set of requested columns to validate its contents prior to serving up data.
froyo-np
commented
May 5, 2026
| }>; | ||
| type Content = Record<string, VBO>; | ||
|
|
||
| export function buildScatterbrainCacheClient( |
Collaborator
Author
There was a problem hiding this comment.
see cache-client.ts
TheMooseman
approved these changes
May 5, 2026
Contributor
TheMooseman
left a comment
There was a problem hiding this comment.
Works on my machine, can't find anything to complain about
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
How
Replace this txt describing what kind of technical overlaying code changes were introduced here.
Screenshots
This section is optional if there are no visible changes
PR Checklist
main?