-
-
Notifications
You must be signed in to change notification settings - Fork 187
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(organizations): code cleanup and patch data cleanup in account settings and tos view TASK-1292 #5290
Merged
pauloamorimbr
merged 11 commits into
main
from
task-1292-refactor-account-settings-and-tos
Nov 28, 2024
Merged
refactor(organizations): code cleanup and patch data cleanup in account settings and tos view TASK-1292 #5290
pauloamorimbr
merged 11 commits into
main
from
task-1292-refactor-account-settings-and-tos
Nov 28, 2024
Conversation
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
jamesrkiger
reviewed
Nov 25, 2024
jamesrkiger
approved these changes
Nov 25, 2024
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 left one comment, but otherwise lgtm
pauloamorimbr
added a commit
that referenced
this pull request
Nov 27, 2024
### 👀 Preview steps No behavior will change with this implementation, but it can be tested by using the new hook somewhere. As a test I've modified `MyProjectRoute` to verify that `currentLoggedAccount` was properly dispatching component re-render and that using hooks methods are working properly as well: ```typescript ... export default function MyProjectsRoute() { const [counter, setCounter] = React.useState(0); const {currentLoggedAccount, refreshAccount} = useSession(); useEffect(() => { setCounter((prev) => prev + 1); }, [currentLoggedAccount]); return ( <> <button onClick={refreshAccount}>Refresh {counter} - {currentLoggedAccount?.username}</button> <UniversalProjectsRoute ... ``` Result:  ### 💭 Notes - This PR adds the `useSession` hook, aimed to be used instead of the current `sessionStore` class to access the session data and methods. - The `useSession` hook returns the `currentLoggedAccount` user, which is already filtered to be an existent account returned from the `/me` endpoint and verified not to be an anonymous account, which is currently done in several places around the codebase where the `currentAccount` from `sessionStore` is used. - The internal implementation of this hook will eventually migrate to use `react-query`, keeping the hook's signature. - This implementation can be used as a base for the migration of the other existing stores to allow for future dropping of `mob-x` in favor of using react-query to cache data. - First usage of this hook can be seen in #5290
d64e43a
to
50de831
Compare
7c910b9
to
0036e25
Compare
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.
👀 Preview steps
/me
endpoint. The payload should only contain the changed fields.preserve log
before saving data)💭 Notes
We're refactoring accountDetails and TOS view on the way of implementing some changes on displayed fields:
useSession
hook created at refactor(organizations): add of useSession hook TASK-1305 #5303PATCH
request to update data