Commit ebeaac9
authored
Fix
* Remove isEditorStarted flag to fix content loss during activity restart
The isEditorStarted flag was preventing editor reinitialization during
activity restarts, but this caused content loss because:
1. Activity restart triggers new fragment creation
2. isEditorStarted gets reset to false in onDestroy()
3. startWithEditorSettings() gets called but always rebuilds from original data
4. Current editor content is lost instead of being preserved
Root cause: The flag was designed to prevent duplicate initialization within
a single fragment instance, but during activity restarts, we WANT the editor
to reinitialize with the current content, not block reinitialization entirely.
Changes:
- Remove isEditorStarted field and related state management
- Remove isEditorStarted checks in startWithEditorSettings()
- Allow editor to reinitialize after activity restart
- Fixes content loss during dark mode toggle
* Fix double ViewPager setup during auth state changes
Prevent duplicate editor initialization by:
1. Only calling fetchWpComCookies() if not already in Success state
2. Adding ViewPager state check to prevent duplicate setup
3. Using distinctUntilChanged() to prevent duplicate LiveData emissions
4. Consolidating Success handling logic in handleSuccessfulAuth()
Changes:
- Check auth state before calling fetchWpComCookies()
- Add ViewPager adapter check with error logging for duplicate setup attempts
- Add distinctUntilChanged() to auth state observer
- Extract handleSuccessfulAuth() for consistent Success state handling
- Remove debug logging from production codeGutenbergKit editor issues during dark mode toggle (#22135)1 parent 205b7da commit ebeaac9
File tree
2 files changed
+30
-16
lines changed- WordPress/src/main/java/org/wordpress/android/ui/posts
- editor
2 files changed
+30
-16
lines changedLines changed: 29 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
617 | 618 | | |
618 | 619 | | |
619 | 620 | | |
620 | | - | |
621 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
622 | 628 | | |
623 | 629 | | |
624 | 630 | | |
| |||
991 | 997 | | |
992 | 998 | | |
993 | 999 | | |
994 | | - | |
| 1000 | + | |
995 | 1001 | | |
996 | 1002 | | |
997 | 1003 | | |
998 | 1004 | | |
999 | 1005 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
| 1006 | + | |
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
| |||
1078 | 1079 | | |
1079 | 1080 | | |
1080 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
1081 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1082 | 1102 | | |
1083 | 1103 | | |
1084 | 1104 | | |
| |||
Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
| |||
235 | 233 | | |
236 | 234 | | |
237 | 235 | | |
238 | | - | |
239 | 236 | | |
240 | 237 | | |
241 | 238 | | |
| |||
464 | 461 | | |
465 | 462 | | |
466 | 463 | | |
467 | | - | |
468 | 464 | | |
469 | 465 | | |
470 | 466 | | |
| |||
507 | 503 | | |
508 | 504 | | |
509 | 505 | | |
510 | | - | |
| 506 | + | |
511 | 507 | | |
512 | 508 | | |
513 | 509 | | |
514 | 510 | | |
515 | | - | |
516 | 511 | | |
517 | 512 | | |
518 | 513 | | |
| |||
583 | 578 | | |
584 | 579 | | |
585 | 580 | | |
586 | | - | |
587 | 581 | | |
588 | 582 | | |
589 | 583 | | |
| |||
0 commit comments