Implements project saving and loading in Play#35
Merged
Conversation
gunsch
commented
Aug 22, 2024
| ? html` | ||
| <div> | ||
| <select id="project-select" size="8"> | ||
| ${this._projects.map( |
Collaborator
Author
There was a problem hiding this comment.
I'm curious what might be a good sort order to show these in. Last updated?
Comment on lines
+54
to
+62
| return new Promise((resolve, reject) => { | ||
| const request = store.add(project) | ||
| request.onsuccess = () => { | ||
| resolve(project) | ||
| } | ||
| request.onerror = () => { | ||
| reject(request.error) | ||
| } | ||
| }) |
There was a problem hiding this comment.
I wonder if we can create a helper for that (and other similar operations)
function IDBRequestToPromise<SuccessPayload>(request: IDBRequest, successPayload: SuccessPayload) {
return new Promise((resolve, reject) => {
request.onsuccess = () => {
resolve(successPayload)
}
request.onerror = () => {
reject(request.error)
}
})
}return IDBRequestToPromise<Project>(store.add(project), project);Something like that. IDK if it's better or not for readability though.
AndreyChernykh
approved these changes
Aug 22, 2024
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.
💸 TL;DR
Implements Project-level saving and loading in Play.
Details
This includes:
ProjectStorageClientinterface, which can be swapped out latersessionStorage, so that it persists across reload but not across tabs