Skip to content

fix(timeline): restore point config sync with number of posts - #162

Merged
ralvarez-dg merged 2 commits into
mainfrom
fix/-timeline-add-elements
Nov 6, 2026
Merged

ralvarez-dg merged 2 commits into
mainfrom
fix/-timeline-add-elements

Conversation

@timothy-mugo

Copy link
Copy Markdown
Contributor

Re-applies the BlockEdit changes that were reverted by 4deb32f: building the config for the new count so existing points keep their settings and only new points get defaults, and repairing short saved configs when the block loads.

Description

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (BREAKING CHANGE:)
  • Refactor / chore (refactor: / chore:)
  • Documentation update (docs:)

Affected package(s)

  • @devgateway/dvz-wp-commons
  • @devgateway/create-wp-customizer
  • @devgateway/upgrade-wp-customizer
  • plugins/wp-react-blocks-plugin
  • plugins/wp-react-custom-api
  • plugins/wp-react-custom-rest-menu
  • Other plugin / theme / Docker (no changeset needed)

Checklist

  • PR title follows Conventional Commits format
  • pnpm build passes locally
  • No hardcoded credentials, internal URLs, client names, or PII introduced
  • Any new dependency has a GPL-2.0-or-later-compatible license (MIT, BSD, Apache-2.0, ISC are all compatible)

Re-applies the BlockEdit changes that were reverted by 4deb32f: building the
config for the new count so existing points keep their settings and only new
points get defaults, and repairing short saved configs when the block loads.
@timothy-mugo
timothy-mugo marked this pull request as ready for review November 6, 2026 10:00
Copilot AI lite review requested due to automatic review settings November 6, 2026 10:00

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.

🟡 Changes recommended

An active moderate issue remains because the builder’s defaults omit tooltipFontColor, causing repaired or newly added points to have an undefined tooltip color instead of the established default.

1 open issue
What changed in this PR

Restores synchronization between timeline post counts and per-point configuration, preserving existing settings, generating defaults for new points, and repairing incomplete saved configurations.

Changes:

  • Adds buildConfig helpers to both timeline block editors.
  • Rebuilds point configuration when the post count changes.
  • Repairs incomplete saved configurations when blocks load.
File Summary
plugins/​wp-react-blocks-plugin/​blocks/​time-line/​BlockEdit.js Restores configuration synchronization and saved-config repair for the original timeline block.
plugins/​wp-react-blocks-plugin/​blocks/​new-time-line/​BlockEdit.js Applies configuration synchronization and saved-config repair to the newer timeline block.

This pull request requires changes.

Review effort: Lite

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 6, 2026 10:04

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.

🔵 Needs a closer look

Both timeline block implementations leave oversized configs unnormalized, so their saved attributes can remain inconsistent with count and retain stale entries.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Trim configs when their length exceeds count

plugins/​wp-react-blocks-plugin/​blocks/​new-time-line/​BlockEdit.js:83

This only repairs configs that are shorter than count; a config with extra entries is left unchanged, so the saved attribute still does not match the count even though buildConfig promises an exact-length result. This occurs with the registered defaults (8 config entries but a default count of 7), and can also revive stale settings if a block was previously saved with a larger count. Normalize whenever the length differs from count (and persist the trimmed result).

Medium severity Trim configs when their length exceeds count

plugins/​wp-react-blocks-plugin/​blocks/​time-line/​BlockEdit.js:84

This only repairs configs that are shorter than count; a config with extra entries is left unchanged, so the saved attribute still does not match the count even though buildConfig promises an exact-length result. This occurs with the registered defaults (8 config entries but a default count of 7), and can also revive stale settings if a block was previously saved with a larger count. Normalize whenever the length differs from count (and persist the trimmed result).

1 resolved since last review

Review effort: Lite

@ralvarez-dg
ralvarez-dg merged commit 833c2dc into main Nov 6, 2026
2 checks passed
@timothy-mugo
timothy-mugo deleted the fix/-timeline-add-elements branch November 9, 2026 09:25
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