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

Merged
merged 4 commits into from
Jun 11, 2024

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

@VilppeRiskidev VilppeRiskidev requested a review from anttimaki May 10, 2024 12:18
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
@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch from 3737e7d to d8074d4 Compare May 13, 2024 11: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.

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 force-pushed the delete-profile-modal-refactor branch from 7889a82 to 99cbcba Compare May 20, 2024 11:47
@VilppeRiskidev VilppeRiskidev self-assigned this May 20, 2024
@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch from 6ec0a39 to 5794d5d Compare May 20, 2024 12:17
@VilppeRiskidev VilppeRiskidev marked this pull request as ready for review May 20, 2024 12:27
@VilppeRiskidev VilppeRiskidev requested a review from anttimaki May 20, 2024 13:41
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
@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch from 24b5361 to cd8c2ff Compare May 24, 2024 06:56
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.

@VilppeRiskidev VilppeRiskidev force-pushed the delete-profile-modal-refactor branch from cd8c2ff to 2faa289 Compare May 28, 2024 12:08
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 👍🏻

@anttimaki anttimaki merged commit d40bc4b into develop Jun 11, 2024
7 checks passed
@anttimaki anttimaki deleted the delete-profile-modal-refactor branch June 11, 2024 05:36
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.

2 participants