-
-
Notifications
You must be signed in to change notification settings - Fork 184
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): add of useSession hook TASK-1305 #5303
Merged
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
pauloamorimbr
changed the title
refactor(organizations): Creation of useSession hook TASK-1305
refactor(organizations): creation of useSession hook TASK-1305
Nov 27, 2024
pauloamorimbr
changed the title
refactor(organizations): creation of useSession hook TASK-1305
refactor(organizations): add of useSession hook TASK-1305
Nov 27, 2024
Akuukis
approved these changes
Nov 27, 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.
LGTM, not tested. Very useful for migrating away from reflux/mobx!
RuthShryock
added a commit
that referenced
this pull request
Nov 27, 2024
)" This reverts commit b8184e8.
pauloamorimbr
added a commit
that referenced
this pull request
Nov 28, 2024
…nt settings and tos view TASK-1292 (#5290) ### 👀 Preview steps 1. ℹ️ have an account and a project 2. Go into account settings view 3. Change information on some field(s) 4. Save the changes 5. Check in the network tab the call to the `/me` endpoint. The payload should only contain the changed fields. 6. Enable a TOS view by following [this document](https://www.notion.so/kobotoolbox/Setting-up-TOS-1447e515f65480f8ab34f69d42d806f8) 7. In the TOS view, fill in the information and save (you may want to `preserve log` before saving data) 8. Check the network tab. Payload should contain only the changed field. ### 💭 Notes We're refactoring accountDetails and TOS view on the way of implementing some changes on displayed fields: - Removed the "global" observer from mob-x which was causing linting issues in favor of using the `useSession` hook created at #5303 - Cleaned up the code - Changed in a way that only changed fields are sent to the `PATCH` request to update data
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
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 thatcurrentLoggedAccount
was properly dispatching component re-render and that using hooks methods are working properly as well:Result:
💭 Notes
useSession
hook, aimed to be used instead of the currentsessionStore
class to access the session data and methods.useSession
hook returns thecurrentLoggedAccount
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 thecurrentAccount
fromsessionStore
is used.react-query
, keeping the hook's signature.mob-x
in favor of using react-query to cache data.