Skip to content

Commit

Permalink
fix(mobile): retain edited title when album updates (#15806)
Browse files Browse the repository at this point in the history
* fix(album-viewer): retain edited title when album updates

ensure `AlbumViewerEditableTitle` keeps user input while editing,
even when the album updates from another provider. fall back to
`albumName` only when not in edit mode.

* linting

---------

Co-authored-by: Alex <[email protected]>
  • Loading branch information
immangat and alextran1502 authored Jan 31, 2025
1 parent 1b141d5 commit 221e197
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mobile/lib/widgets/album/album_viewer_editable_title.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ class AlbumViewerEditableTitle extends HookConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final titleTextEditController = useTextEditingController(text: albumName);
final albumViewerState = ref.watch(albumViewerProvider);

final titleTextEditController = useTextEditingController(
text: albumViewerState.isEditAlbum &&
albumViewerState.editTitleText.isNotEmpty
? albumViewerState.editTitleText
: albumName,
);

void onFocusModeChange() {
if (!titleFocusNode.hasFocus && titleTextEditController.text.isEmpty) {
Expand Down

0 comments on commit 221e197

Please sign in to comment.