-
Notifications
You must be signed in to change notification settings - Fork 637
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
Swaps Rearchitecture #5705
Swaps Rearchitecture #5705
Conversation
filter: UserAssetFilter; | ||
searchQuery: string; | ||
favoriteAssetIds: Hex[]; // this is chain agnostic, so we don't want to store a UniqueId here | ||
setFavorites: (favoriteAssetIds: Hex[]) => void; |
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.
are there scenarios when we need to set multiple favorites at once?
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.
not that i'm aware of, but maybe?
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 function is more for initializing the favorites store, but probably unnecessary.
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.
ya i think we'll only need to do that once when we migrate data over from the current react query favorites cache. prob can just have setFavorite
and call that iteratively for that single migration
// Removing the value when the input is focused allows the input to be reset to the correct value on blur | ||
const query = isFocused ? undefined : defaultValue; | ||
|
||
return { defaultValue, text: query }; |
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 dont think default value needs to be an animated prop but we can change this 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.
I agree, but when I removed it typescript was yelling at me for whatever reason..
return SwapInputController.searchQuery.value; | ||
}, [SwapInputController.searchQuery.value]); | ||
const defaultValue = useMemo(() => { | ||
return userAssetsStore.getState().searchQuery; |
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 am most likely just misunderstanding but why do we need to set the default value to the initial searchQuery? Wouldn't the initial searchQuery just be ""?
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 think that assumption is always true, good point.
return userAssetsStore.getState().searchQuery; | ||
}, []); | ||
|
||
const onSearchQueryChange = useCallback((event: NativeSyntheticEvent<TextInputChangeEventData>) => { |
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.
also unrelated to the main focus of this pr, but i feel like this would be cleaner if it just accepts a string. that way you wouldn't be creating artificial NativeSyntheticEvents below
Fixes APP-####
What changed (plus any additional context for devs)
This PR introduces some of the changes laid out in the swaps re-architecture document here. Mainly:
Screen recordings / screenshots
What to test