forked from eatvio/eatvio_app
fix: plans - like and bookmark in consultant profile (#582)
- decouple PlanWidget from feed PlansCubit via owner-provided callbacks - add like/favorite actions to profile PlansCubit: slug lookup, optimistic update, rollback of the affected plan, per-slug debounce, isClosed guards - pass slug through like/favorite/comments events; guard out-of-range index in feed plans handlers and deep-link about_plan sync - capture post like intent before await in profile blog post widget - replace null force-unwraps in profile screen, guard indexOf == -1 - tests: profile plan like/bookmark, slug sync, bounds guards, #700 regression
This commit is contained in:
@@ -44,6 +44,7 @@ class CustomPopup extends StatelessWidget {
|
||||
final PlanModel? plan;
|
||||
final String userSlug;
|
||||
final VoidCallback? onPostsChanged;
|
||||
final VoidCallback? onPlanChanged;
|
||||
|
||||
const CustomPopup({
|
||||
super.key,
|
||||
@@ -59,6 +60,7 @@ class CustomPopup extends StatelessWidget {
|
||||
this.plan,
|
||||
required this.userSlug,
|
||||
this.onPostsChanged,
|
||||
this.onPlanChanged,
|
||||
});
|
||||
|
||||
bool get _isAdminAuthor =>
|
||||
@@ -166,9 +168,13 @@ class CustomPopup extends StatelessWidget {
|
||||
try {
|
||||
context.read<AboutPlanCubit>().getPlan(slug: currentPlan.slug);
|
||||
} catch (_) {}
|
||||
try {
|
||||
context.read<PlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
if (onPlanChanged != null) {
|
||||
onPlanChanged!();
|
||||
} else {
|
||||
try {
|
||||
context.read<PlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
}
|
||||
try {
|
||||
context.read<MyPlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
|
||||
Reference in New Issue
Block a user