Skip to content

Render an activity once when an update moves it into, out of, or between part groupings - #5967

Merged
Eugene (OEvgeny) merged 4 commits into
mainfrom
OEvgeny/fix-activity-leaving-part-group
Oct 23, 2026
Merged

Eugene (OEvgeny) merged 4 commits into
mainfrom
OEvgeny/fix-activity-leaving-part-group

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

An activity re-sent with the same ID but a different (or no) HowTo isPartOf is rendered twice; development builds throw "graph has N activities, Redux has N+1 activities".

Changelog Entry

Fixed

  • Fixed activities updated into, out of, or between part groupings rendered twice, in PR #5967, by @OEvgeny

Description

When an update moved an activity out of, into, or between HowTo part groupings, upsert() added it by its new grouping but never removed it from its previous place. It now removes the previous revision (and an emptied grouping) before inserting the update.

Design

  • Reuses deleteActivityByLocalId() for non-livestream activities whose HowTo grouping ID changed, instead of a second removal path inside upsert(); updates within the same grouping are untouched.
  • Livestream revisions are excluded because their grouping belongs to the session, so deleting one revision would un-finalize or split it.

Specific Changes

  • sort/upsert.ts: remove the previous revision when its HowTo grouping changed
  • upsert.howTo.spec.ts: leave a grouping, move to another (emptied one dropped), join a grouping, same grouping unchanged
  • upsert.howToWithLivestream.spec.ts: a re-sent final or older revision without isPartOf keeps the session finalized and renders once
  • I have added tests and executed them locally
  • I have added .changelog/<PR#>-<slug>.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Eugene Olonov added 3 commits October 22, 2026 16:23
An update with the same ID that leaves, joins, or moves between HowTo groupings
stayed in its previous grouping and was inserted again, so it was rendered twice.
@OEvgeny

Copy link
Copy Markdown
Collaborator Author

William Wong (@compulim), a question for a follow-up (this PR deliberately leaves livestream activities alone):

A livestream session in a HowTo grouping can get a later revision with another isPartOf (another grouping, or none). Today upsert() keeps the session in its old place and adds it to the new one, so the revision renders twice. Which grouping should the session follow?

  • A. Its latest (highest-sequence) revision's grouping: same as plain activities in this PR, and the UI already bins each rendered revision by its own isPartOf (createDefaultGroupActivitiesMiddleware.ts).
  • B. Its first revision's grouping: later revisions inherit it; the UI binning must then change too, because the rendered revision's isPartOf disagrees.

We recommend A. OK to go with A?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@OEvgeny
Eugene (OEvgeny) merged commit 7dee82a into main Oct 23, 2026
33 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-activity-leaving-part-group branch October 23, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants