-
Notifications
You must be signed in to change notification settings - Fork 495
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
Refactor major components to streamline logic #1589
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d925c3b
feat: web native file add
Gozala e6336ed
chore: merge upstream
Gozala e636d2b
chore: integarte new ipfs & upload/download events
Gozala f235c33
chore: code refactor & cleanup
Gozala 64702a5
fix: view that assumed older state structure
Gozala 6043e97
fix: refactor other bundles
Gozala d4d8561
save draft
Gozala 9f6512a
fix: type incompatibilities
Gozala f2ac8f1
chore: turn perform and spawn into action creators
Gozala 01c529d
chore: update docs
Gozala 0fa1188
fix: introduces regressions
Gozala aa1d733
Update src/bundles/files/utils.js
Gozala 21a49b2
Apply suggestions from code review
Gozala d9343c7
Merge remote-tracking branch 'upstream/master' into code-refactor
Gozala 6e01b90
chore: put back `\n` at end of json file
Gozala 448a28c
fix: regression introuded by missing `-` char.
Gozala 271b90e
fix: address review comments
Gozala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare module "it-first" { | ||
function first<T>(input: AsyncIterable<T>): Promise<T> | ||
|
||
export default first | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
declare module "redux-bundler" { | ||
|
||
interface CreateSelector { | ||
<State, I, O>(n1: string, f: (inn: I) => O): (state: State) => O, | ||
<State, I1, I2, O>(n1: string, n2: string, f: (i1: I1, i2: I2) => O): (state: State) => O | ||
<State, I1, I2, I3, O>(n1: string, n2: string, n3: string, f: (i1: I1, i2: I2, i3: I3) => O): (state: State) => O | ||
<State, I1, I2, I3, I4, O>(n1: string, n2: string, n3: string, n4: string, f: (i1: I1, i2: I2, i3: I3, i4: I4) => O): (state: State) => O | ||
<State, I1, I2, I3, I4, I5, O>(n1: string, n2: string, n3: string, n4: string, n5: string, f: (i1: I1, i2: I2, i3: I3, i4: I4, i5: I5) => O): (state: State) => O | ||
|
||
<State, I1, O>(s1: (state: State) => I1, f: (inn: I1) => O): (state: State) => O, | ||
<State, I1, I2, O>(s1: (state: State) => I1, s2: (state: State) => I2, f: (i1: I1, i2: I2) => O): (state: State) => O | ||
<State, I1, I2, I3, O>(s1: (state: State) => I1, s2: (state: State) => I2, s3: (state: State) => I3, f: (i1: I1, i2: I2, i3: I3) => O): (state: State) => O | ||
<State, I1, I2, I3, I4, O>(s1: (state: State) => I1, s2: (state: State) => I2, s3: (state: State) => I3, s4: (state: State) => I4, f: (i1: I1, i2: I2, i3: I3, i4: I4) => O): (state: State) => O | ||
<State, I1, I2, I3, I4, I5, O>(s1: (state: State) => I1, s2: (state: State) => I2, s3: (state: State) => I3, s4: (state: State) => I4, s5: (state: State) => I5, f: (i1: I1, i2: I2, i3: I3, i4: I4, i5: I5) => O): (state: State) => O | ||
} | ||
|
||
declare export var createSelector: CreateSelector | ||
|
||
export type Selector<State, Data> = | ||
(state: State) => Data | ||
|
||
type Action = { type: string } | ||
|
||
|
||
|
||
export type BaseStore<State, Message extends Action> = { | ||
getState(): State | ||
dispatch(message: Message): void | ||
|
||
destroy(): void | ||
} | ||
|
||
export type Store<State, Message extends Action, Ext = {}> = { | ||
getState(): State | ||
dispatch(message: Message): void | ||
subscribeToSelectors(selectors: string[], callback: (any) => void | (() => void)): void | ||
|
||
destroy(): void | ||
} & Ext | ||
|
||
|
||
export type Context<State, Message extends Action, Ext, Extra = {}> = { | ||
getState(): State | ||
dispatch(message: Message): void | ||
store: Store<State, Message, Ext> | ||
} & Extra | ||
|
||
export type Reducer<State, Message> = | ||
(state?: State, message: Message) => State | ||
|
||
export type BundleInit<State, Messag extends Action, Ext = {}> = | ||
(store: Store<State, Message, Ext>) => void | (() => void) | ||
|
||
export type Bundle<State, Message extends Action, Ext = {}, Extra = never> = { | ||
name: string | ||
reducer?: Reducer<State, Message> | ||
getReducer?: () => Reducer<State, Message> | ||
} | ||
|
||
|
||
export type Selectors<T> = { | ||
[K in keyof T]: T[K] extends Selector<any, infer D> | ||
? () => D | ||
: never | ||
} | ||
|
||
export type Actions<T> = { | ||
[K in keyof T]: (...args: ParamsType<T[K]>) => ReturnType<ReturnType<T[K]>> | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
💭 OOF, I have bad feelings about maintaining this long term.
@Gozala thoughts on how feasible it is to pick HenrikJoreteg/redux-bundler#69 up and add those types to the upstream package (with GitHub action that tests them there)?
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.
I don't believe it is worth it honestly. Because it is not really possible to add proper typings to the redux-bundler. What I do here is just provide some subset which also requires very particular use of redux-bundler (splitting actions and selectors, which seems to go against it's design goals), and even then have to manually annotate. Given these limitations, I doubt it would be accepted, I also don't think the effort to do that is going to pay off.
If we were to invest more time into this, I would rather consider using redux-bundler alternatives that would be more type friendly / ready than redux-bundler is.