Skip to content

Conversation

@WojciechMat
Copy link
Collaborator

@WojciechMat WojciechMat commented Jun 16, 2025

Remove Profile Saved Successfully Notification

Problem:
The "Profile saved successfully!" message was showing up every time the profile page loaded, not just when the user actually saved changes.

Solution:

  • Added a new ProfileSaved state that only triggers when profile is actually saved
  • Updated the listener to only show success message for ProfileSaved state instead of any ProfileLoaded state

Changes:

  • profile_state.dart: Added ProfileSaved state class
  • profile_cubit.dart: Emit ProfileSaved instead of ProfileLoaded after successful update
  • profile_page.dart: Listen for ProfileSaved state only

Result:
Success message now only appears when user actually saves profile changes, not on every page load.

@WojciechMat WojciechMat changed the base branch from main to dev June 16, 2025 11:48
@WojciechMat WojciechMat requested a review from kryczkal June 16, 2025 11:52
Copy link
Collaborator

@kryczkal kryczkal left a comment

Choose a reason for hiding this comment

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

LGTM

@kryczkal kryczkal requested a review from Copilot June 16, 2025 11:52
@WojciechMat WojciechMat merged commit ab5e45f into dev Jun 16, 2025
2 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refines the profile-saving flow so that the success snackbar only appears after an actual save, not on every page load.

  • Introduces a dedicated ProfileSaved state
  • Emits ProfileSaved instead of ProfileLoaded after updating the profile
  • Listens for ProfileSaved in the UI to show the success message

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
frontend/lib/presentation/profile/pages/profile_page.dart Updated the listener to trigger only on ProfileSaved
frontend/lib/presentation/profile/cubit/profile_state.dart Added new ProfileSaved state subclass
frontend/lib/presentation/profile/cubit/profile_cubit.dart Changed emit from ProfileLoaded to ProfileSaved
Comments suppressed due to low confidence (3)

frontend/lib/presentation/profile/cubit/profile_state.dart:4

  • [nitpick] For consistency with the error state (ProfileUpdateError), consider renaming ProfileSaved to something like ProfileUpdateSuccess to make the success state name parallel to the error naming convention.
class ProfileSaved extends ProfileLoaded {

frontend/lib/presentation/profile/cubit/profile_cubit.dart:42

  • Update or add unit tests to verify that the cubit emits ProfileSaved upon a successful update, ensuring this new state transition is covered.
emit(ProfileSaved(userProfile: updatedProfile));

frontend/lib/presentation/profile/cubit/profile_state.dart:4

  • [nitpick] Add a doc comment above ProfileSaved to explain its purpose and how it differs from ProfileLoaded to improve maintainability.
class ProfileSaved extends ProfileLoaded {

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.

3 participants