Add a new helper type for SAFE.Client: Optimistic#12
Closed
aplikethewatch wants to merge 5 commits intomainfrom
Closed
Add a new helper type for SAFE.Client: Optimistic#12aplikethewatch wants to merge 5 commits intomainfrom
Optimistic#12aplikethewatch wants to merge 5 commits intomainfrom
Conversation
…frontend development. what changed?: add new helper client types for optimistic update why?: aid in front end development effect?: n/a
what changed?: more xml docs and change Curr property to Value for more familiar usage why?: doing x.Curr makes less sense than doing x.Value effect?: n/a
Contributor
|
Interesting addition, curious to see it in action! A few pieces of feedback:
|
…based on PR feedback. what changed?: added tests for Optimistic helper type; Also added utility functions for Optimistic helper type why?: from pr feedback effect?: better tested library
what changed?: opt in for a DU instead of a record type for Optimistic helper type why?: make illegal states unrepresentable effect?: n/a
| let startLoading (remote: RemoteData<'T>) = remote.StartLoading | ||
|
|
||
| ///A type which represents optimistic updates. | ||
| type Optimistic<'T> = |
Contributor
There was a problem hiding this comment.
I feel like the case names could perhaps be clearer.
Author
There was a problem hiding this comment.
Could it be represented as an option instead? like
type Optimistic<'T> = (current: 'T * previous: 'T option) option| | Exists (v, pv) -> Exists (value, Some v) | ||
|
|
||
| /// Rolls back to the previous value, discarding the current one. | ||
| member this.Rollback () = |
Contributor
There was a problem hiding this comment.
Suggested change
| member this.Rollback () = | |
| member this.RollBack () = |
"Rollback" is a noun, "roll back" is the verb
Author
There was a problem hiding this comment.
I honestly prefer Rollback
Co-authored-by: Matt Gallagher <46973220+mattgallagher92@users.noreply.github.com>
Contributor
|
@arpxspace All actual code for this project has been moved to SAFE.Utils. Can you move this PR there? |
Author
|
This PR has now moved here |
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.
supports frontend development.
what changed?: add new helper client types for optimistic update
why?: aid in front end development
implements #11