-
Notifications
You must be signed in to change notification settings - Fork 9
feat: memory replica in idb #989
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
Conversation
| const merged = merge(stored, entry); | ||
| if (merged === undefined) { | ||
| this.store.delete(key); | ||
| updated.add(key); |
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.
If we delete here, we'll pass undefined to the subscriber on line 194, which violates the type signature for that method. It's possible there's some guarantee that we won't have a subscriber in that case, but I'm not sure that's true.
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.
This is a good catch, thanks for spotting it. I guess I'm not sure what the right solution here, because we need to route this back to sink callback
labs/runner/src/storage/base.ts
Lines 55 to 58 in e07b5c6
| sink<T = any>( | |
| entityId: EntityId, | |
| callback: (value: StorageValue<T>) => void, | |
| ): Cancel; |
@seefeldb what should I pass into a callback when fact is removed / retracted ? I think it does not happen in practice but I imagine we need to support this. I think we either pass no value or we do not call subscription at all.
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.
Did this in the meantime to fix spotted issue c899082
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.
Let's call it with {} as StorageValue for now. That removes the source and sets the value to undefined. Maybe add a TODO, since this isn't really the same as actual deleting. Thanks!
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.
Addressed in f648213
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Illustration of the design
To try this branch you need to run local toolshed
cd toolshed deno task devAnd run local jumble pointing at it e.g.