kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

coach - overly aggressive errors from page title logic as state is changing

Open thanksameeelian opened this issue 1 year ago • 12 comments

Observed behavior

excessive errors in the console when user deletes a lesson in Coach - it appears that as user is automatically navigated away from the page of the lesson that the user just deleted, there are several calls to get page title using the details of the just-deleted lesson, leading to an error as that lesson no longer exists.

there do not appear to be any errors related to the actual page the user is automatically navigated to (the class's lesson list page) and its title displays correctly. unnecessary calls are potentially being made to get the previous page title as we are exiting it & subsequent errors are getting logged in the console during the transition away from a page that no longer exists.

Errors and logs

Failed to obtain page title. Ensure that this route's meta.titleParts are correctly configured.   |    useCoreCoach.js:64

image

image

https://github.com/learningequality/kolibri/assets/43046460/ef6d857a-74e1-48f3-8ec5-779d081cfc91

Expected behavior

  • only make calls to determine page title on appropriate & necessary pages when navigating between pages

Steps to reproduce

  • Coach > [select facility &/or class] > Plan > Lessons > [create a temporary lesson if necessary] > Select lesson
  • on the lesson's Summary page, Options > Delete lesson & confirm choice in the modal
  • should be automatically navigated back to class's Plan > Lessons page
  • despite successful navigation & appropriate page title displayed, errors in console during transition between pages

thanksameeelian avatar Sep 22 '23 19:09 thanksameeelian

I would love to look into this issue.

ShivangRawat30 avatar Sep 23 '23 15:09 ShivangRawat30

awesome - thank you @ShivangRawat30! i've assigned you 🙂

thanksameeelian avatar Sep 25 '23 16:09 thanksameeelian

can i work on this?

nick2432 avatar Jan 18 '24 03:01 nick2432

Hi @nick2432, I think you can give it a try, thank you. It may be helpful to read through https://github.com/learningequality/kolibri/pull/11338 and feedback provided there to know what to be careful about.

MisRob avatar Jan 18 '24 12:01 MisRob

Hi @nick2432, I think you can give it a try, thank you. It may be helpful to read through #11338 and feedback provided there to know what to be careful about.

I will give it a try. Thank you, @MisRob !

nick2432 avatar Jan 18 '24 17:01 nick2432

Hey @thanksameeelian , I've spent two days on this issue and have some questions. The main problem is that when I navigate from the lesson page to any other page, I receive a SUMMARY from PLAN_LESSONS_ROOT and then PLAN_LESSONS_ROOT from SUMMARY in the console. This occurs because of the following line of code: return classSummary.lessonMap[params.lessonId].title. Interestingly, when I just return classSummary, it works fine, but using classSummary.lessonMap[params.lessonId] results in an unexpected behavior.

https://github.com/learningequality/kolibri/assets/77477551/00cefd5a-9c4d-4474-a2bf-0225160e3d4e

https://github.com/learningequality/kolibri/assets/77477551/a777ad3d-a69a-408d-a6fc-77c09cf46646

nick2432 avatar Jan 22 '24 12:01 nick2432

Hi @nick2432, thank you for looking into this! Seems you're onto something related.

I've spent two days on this issue and have some questions. The main problem is that when I navigate from the lesson page to any other page, I receive a SUMMARY from PLAN_LESSONS_ROOT and then PLAN_LESSONS_ROOT from SUMMARY in the console.

Can I understand right that the problem you're referring to can be seen in the first recording when you return from the lesson summary page back to the root page, but shortly before the navigation occurs, there are some calls to retrieve the summary page title despite we're navigating from it?

This occurs because of the following line of code: return classSummary.lessonMap[params.lessonId].title. Interestingly, when I just return classSummary, it works fine, but using classSummary.lessonMap[params.lessonId] results in an unexpected behavior.

Could you please send links to related code you're mentioning so that I know where to look at exactly? Alternatively, you can open a draft pull request and push your logging. We could then use pull request comments to talk about relevant places.

MisRob avatar Jan 23 '24 14:01 MisRob

Can I understand right that the problem you're referring to can be seen in the first recording when you return from the lesson summary page back to the root page, but shortly before the navigation occurs, there are some calls to retrieve the summary page title despite we're navigating from it?

yes

Could you please send links to related code you're mentioning so that I know where to look at exactly? Alternatively, you can open a draft pull request and push your logging. We could then use pull request comments to talk about relevant places.

https://github.com/learningequality/kolibri/blob/release-v0.16.x/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js#L55

nick2432 avatar Jan 24 '24 04:01 nick2432

@nick2432 Alright, got it. One idea I had was that perhaps finding out why formatPageTitle is called in the first place would help to understand better what's actually the main problem. Since formatPageTitle is returned from the reactive computed here https://github.com/learningequality/kolibri/blob/release-v0.16.x/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js#L13, it's possible that it's being triggered unexpectedly under certain conditions. You could try to track related functions calls as you navigate to create a mental picture of what's going on.

MisRob avatar Jan 24 '24 12:01 MisRob

@MisRob , I tried a lot, but I don't think I can do this. I'm sorry. Can you please unassign me from this issue? I have some ideas, but I doubt they will work for the original problem.

nick2432 avatar Feb 01 '24 03:02 nick2432

Alright @nick2432, thank you for your effort.

MisRob avatar Feb 01 '24 08:02 MisRob

Depends on what's the problem but @rtibbles mentioned that https://vue-meta.nuxtjs.org/ may be handy if this shows to be a higher-level problem with the way we're approaching updating page metadata

MisRob avatar Apr 02 '24 13:04 MisRob