Skip to content
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 Delete Profile Modal by separating it from Profiles.vue #1325

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

VilppeRiskidev
Copy link
Collaborator

@VilppeRiskidev VilppeRiskidev commented May 10, 2024

  • DeleteProfileModal has been separated from Profiles.vue
  • profileList has been added to Vuex storage

Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This on right track.

src/components/profiles-modals/DeleteProfileModal.vue Outdated Show resolved Hide resolved
src/components/profiles-modals/DeleteProfileModal.vue Outdated Show resolved Hide resolved
src/pages/Profiles.vue Outdated Show resolved Hide resolved
@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch 2 times, most recently from 0cc9d69 to 3737e7d Compare May 13, 2024 11:15
- `DeleteProfileModal` has been separated from `Profiles.vue`
- `profileList` has been added to Vuex storage
Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall things are starting to look good. Use your own judgement on the comments marked as minor or nitpick. I'd like the rest of the comments addressed, i.e. changed or argumented why the suggested change is not a good idea.

src/components/profiles-modals/DeleteProfileModal.vue Outdated Show resolved Hide resolved
src/components/profiles-modals/DeleteProfileModal.vue Outdated Show resolved Hide resolved
src/pages/Profiles.vue Show resolved Hide resolved
src/pages/Profiles.vue Show resolved Hide resolved
src/pages/Profiles.vue Outdated Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch 2 times, most recently from 658b20c to 7889a82 Compare May 18, 2024 16:26
Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on the requested changes, but some new things emerged as a result.

src/components/profiles-modals/DeleteProfileModal.vue Outdated Show resolved Hide resolved
src/pages/Profiles.vue Outdated Show resolved Hide resolved
src/pages/Profiles.vue Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
…asynchronous

- Changes have been made to `updateProfileList()` function.
- End results have not been changed, only getting there has been improved.
@VilppeRiskidev VilppeRiskidev self-assigned this May 20, 2024
@VilppeRiskidev VilppeRiskidev marked this pull request as ready for review May 20, 2024 12:27
Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes themselves passed my review, but I did some manual testing and detected a bug. It's actually a regression since I broke the same thing when implementing the "cache prewarming" a while back. Anyway, it should be easy to fix (but do test it yourself since I didn't.)

src/pages/Profiles.vue Show resolved Hide resolved
Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug still remains in one special case.

throw R2Error.fromThrownValue(e, 'Error whilst deleting profile from disk');
}

if (profileName.toLowerCase() !== 'default') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Default profile is "deleted", new empty Default profile should be created instantly - and it does. However, when that profile is selected, it still shows the mods of the Default profile that was deleted. I think this if-clause might be the culprit. Either we should always call setSelectedProfile at the end of removeSelectedProfile; or we could add an else-clause here that calls just profile/updateModListFromFile and tsMods/prewarmCache.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You went a little overboard with this. Now, in addition to always calling setSelectedProfile, you also always filter the removed profile name from the list of profiles. We don't want to do that if it was the default profile - the Default should always be visible on the list.

(IDK if there's a good rationale to treat the default profile differently, but at least the code base assumes that there's always a profile called Default, so it's nice for UI to reflect that. And that's how it has worked so far, so maybe we shouldn't change that in this PR.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ok now

src/store/modules/ProfilesModule.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another bug crept up.

Copy link
Collaborator

@anttimaki anttimaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants