-
Notifications
You must be signed in to change notification settings - Fork 750
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
Created equivalent of getters for all accessed session state and all getters in useUser composable #11738
Created equivalent of getters for all accessed session state and all getters in useUser composable #11738
Conversation
const isAdmin = computed(() => store.getters.isAdmin); | ||
const isSuperuser = computed(() => store.getters.isSuperuser); | ||
const canManageContent = computed(() => store.getters.canManageContent); | ||
const isLearnerOnlyImport = computed(() => store.getters['session/isLearnerOnlyImport']); |
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 is not what was intended at all.
The purpose of the issue is to continue the work that was started here, providing composable interface to each of the getters in the session module, and to each element of the store state.
No changes to these existing exports should be made, and no changes should be made to session.js.
Instead, I should be seeing additional computed props returned from this composable that map to each of the getters defined in session.js and to each of the state values defined in the same file.
Hi @dhruvpal05! could you also add the actual GH issue you are working against so there is better context for the reviewer. Under References section you can use any of |
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.
Hi @dhruvpal05! Based on @rtibbles review, this will certainly require changes. Please be sure to let us know incase you have a clarifying questions answered. Thanks
bdf2c15
to
e80feb9
Compare
Hi @akolson , thank you for the review, I want to ask that I have to make getters for the functions whose getters are not defined in session.js like this |
Hi @dhruvpal05, no need to define any additional getters in the vuex session.js module here. As a guide, if you have edited session.js while doing this issue, you have made a mistake. The new computed props in the composable can simply directly reference the existing state or getters from the module. |
Hi @dhruvpal05! Thanks. It, however looks like there are conflicts that you will need to fix before a proper review can be done. |
As @akolson mentioned, you have some unresolved merge conflicts that you have committed. In addition, it seems like this guidance is still not being followed here:
|
Hello @dhruvpal05, are you planning to follow-up here or would it be better to close the pull request? |
Summary
I modified the getter names in useuser.js to include the 'session/' namespace because these getters are defined in the session.js module. Vuex uses namespaces to organize state, getters, mutations, and actions from different modules.
I added the specified getters to the session.js module with the 'session/' namespace. These getters are the ones being accessed in the useUser composable. Additionally, I adjusted the existing getters to use the 'session/' namespace where necessary.
These changes ensure that the getters from session.js are properly accessed through the useUser composable in useuser.js.
…
References
Closes #11723
…
Reviewer guidance
…
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)