@@ -436,12 +436,8 @@ export default {
436436
437437 watch: {
438438 scheduleEntryId: {
439- async handler (id ) {
440- try {
441- this .scheduleEntry = this .api .get ().scheduleEntries ({ id })
442- } catch {
443- this .scheduleEntry = await firstActivityScheduleEntry (this .activityId )
444- }
439+ async handler () {
440+ await this .loadScheduleEntry ()
445441 },
446442 immediate: true ,
447443 },
@@ -452,24 +448,52 @@ export default {
452448 this .loading = true
453449 await this .scheduleEntry .activity ()._meta .load // wait if activity is being loaded as part of a collection
454450 this .loading = false
455-
456451 // no refresh of activity here because the requireActivityScheduleEntry guard already does a refresh
457452 },
458453
459454 methods: {
455+ async loadScheduleEntry () {
456+ try {
457+ this .scheduleEntry = this .api .get ().scheduleEntries ({ id: this .scheduleEntryId })
458+ } catch {
459+ this .scheduleEntry = await firstActivityScheduleEntry (this .activityId )
460+ }
461+ },
460462 changeCategory (category ) {
461463 this .categoryChangeState = ' saving'
462464 this .activity
463465 .$patch ({
464466 category: category ._meta .self ,
465467 })
466468 .catch ((e ) => this .$toast .error (errorToMultiLineToast (e)))
467- .then (() => (this .categoryChangeState = null ))
469+ .then (() => {
470+ this .categoryChangeState = null
471+ if (category .numberingStyle !== this .scheduleEntry .numberingStyle ) {
472+ // When changing numbering styles, the schedule entry numbers of all schedule
473+ // entries in the whole period may change
474+ this .reloadAllScheduleEntriesInRelatedPeriods ()
475+ }
476+ })
468477 .catch ((e ) => {
469478 this .categoryChangeState = ' error'
470479 this .$toast .error (errorToMultiLineToast (e))
471480 })
472481 },
482+ async reloadAllScheduleEntriesInRelatedPeriods () {
483+ const periods = [
484+ ... new Set (
485+ this .activity .scheduleEntries ().items .map ((scheduleEntry ) => {
486+ return scheduleEntry .period ()
487+ })
488+ ),
489+ ]
490+ await Promise .all (
491+ periods .map (async (period ) => {
492+ period .scheduleEntries ().$reload ()
493+ })
494+ )
495+ this .loadScheduleEntry ()
496+ },
473497 scheduleEntryRoute,
474498 countContentNodes (contentType ) {
475499 return this .contentNodes .items .filter ((cn ) => {
0 commit comments