Skip to content

Conversation

@pfefferle
Copy link
Member

Enforces canonical field order in the Social Web feed DataViews to ensure fields always display in the same order regardless of user toggling field visibility. When a user hides and re-shows a field, it now returns to its original position instead of being appended to the end.

Problem

When users toggle field visibility in DataViews, the view.fields array gets modified. If a user hides a field and then shows it again, DataViews appends it to the end of the array instead of returning it to
its original position. This causes the field order to become inconsistent and break the intended display order.

Solution

Implements field order normalization by:

  1. Defining a canonical field order in the fields array: metadata → title → excerpt → content → date
  2. Creating a normalizedView that sorts view.fields according to the canonical order
  3. Using a Map to track each field's position in the canonical order
  4. Sorting visible fields to match that order, regardless of when they were toggled on/off

Proposed changes

  • Add field order normalization logic using useMemo
  • Create normalizedView that maintains canonical field order
  • Use normalizedView in DataViews component instead of raw view
  • Rebuild JavaScript assets

Example

Before:

  1. User sees: metadata, title, excerpt
  2. User hides title
  3. User hides excerpt
  4. User shows excerpt → Result: metadata, excerpt (wrong order)
  5. User shows title → Result: metadata, excerpt, title (wrong order)

After:

  1. User sees: metadata, title, excerpt
  2. User hides title
  3. User hides excerpt
  4. User shows excerpt → Result: metadata, excerpt (correct)
  5. User shows title → Result: metadata, title, excerpt (correct - maintains canonical order)

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Build completes successfully
  • Fields display in canonical order: metadata, title, excerpt, content, date
  • Hiding and re-showing fields maintains canonical order
  • Field visibility preferences still persist via useView hook

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Removes the actions dropdown (burger menu) containing like, boost, reply, and open original actions from the feed DataViews component. These actions were placeholders that opened the original post in a new tab, and their removal simplifies the UI while users can still click on posts to view them in the inspector panel.

Changes:
- Remove getFeedActions import and actions initialization
- Remove actions prop from DataViews component
- Rebuild JavaScript assets
Enforces canonical field order in the Social Web feed DataViews to ensure fields always display in the same order regardless of user toggling field visibility. When a user hides and re-shows a field, it now returns to its original position instead of being appended to the end.

Problem:
When users toggle field visibility in DataViews, the view.fields array gets modified. If a user hides a field and then shows it again, DataViews appends it to the end of the array instead of returning it to its original position. This causes the field order to become inconsistent.

Solution:
Implements field order normalization by defining a canonical order (metadata → title → excerpt → content → date) and sorting view.fields to match that order using a Map for position tracking.

Changes:
- Add field order normalization logic using useMemo
- Create normalizedView that maintains canonical field order
- Use normalizedView in DataViews component
- Rebuild JavaScript assets
Copilot AI review requested due to automatic review settings November 18, 2025 08:43
@pfefferle pfefferle changed the base branch from trunk to add/reader November 18, 2025 08:43
@github-actions github-actions bot added the [Focus] Editor Changes to the ActivityPub experience in the block editor label Nov 18, 2025
@pfefferle pfefferle self-assigned this Nov 18, 2025
@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Nov 18, 2025
@pfefferle pfefferle requested a review from obenland November 18, 2025 08:44
Copilot finished reviewing on behalf of pfefferle November 18, 2025 08:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Introduced a new module exporting a deep object equality function in build/social-web/feed-stage.js. Updated build outputs to include this utility, which can be used for comparing complex objects, arrays, Maps, Sets, and other types for structural equality.
Corrects the item count display in the bulk actions footer to show the number of selected items instead of the total number of items when items are selected.
@pfefferle pfefferle merged commit 4b1d07a into add/reader Nov 18, 2025
3 checks passed
@pfefferle pfefferle deleted the fix/field-order-normalization branch November 18, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Focus] Editor Changes to the ActivityPub experience in the block editor Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants