Changing a xb_page draft published & isNew status can trigger stale layout

Created on 9 May 2025, 3 days ago

Overview

in UnpublishedChanges.tsx there is this bit of logic

if (isCurrentChanged) {
        // Update the isPublished and isNew status.
        dispatch(
          componentAndLayoutApi.util.updateQueryData(
            'getLayoutById',
            entityId,
            (draft) => {
              draft.isPublished = true;
              draft.isNew = false;
            },
          ),
        );
      }

This in turn triggers the useEffect in Layout.tsx because the value returned by useGetLayoutByIdQuery(entityId) has changed

More specifically, the isPublished and isNew properties have changed.

This results in the useEffect seeing if there is layout html available, and if so, it updates the layout with it. However, this HTML is the value provided on initial load, and this effectively empties the layout in Redux even though it's properly saved on the back end.

Proposed resolution

Look at the initial MR which does work, use it to inspire a more robust solution.

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024