Skip to content

Blueprints: Fix creating documents from blueprints (closes #21996)#22688

Merged
nielslyngsoe merged 1 commit into
release/17.4.0from
v17/hotfix/21996-new-from-blueprint-v2
May 4, 2026
Merged

Blueprints: Fix creating documents from blueprints (closes #21996)#22688
nielslyngsoe merged 1 commit into
release/17.4.0from
v17/hotfix/21996-new-from-blueprint-v2

Conversation

@nielslyngsoe
Copy link
Copy Markdown
Member

cherry-picked fix from #22422

Description

Fixes #21996

Testing

May be tricky to reproduce unless you want a copy of the database that shows the error, but it should be enough to verify that new documents can be created when selected from a list of blueprints, and you can successfully create one, scaffold it, then change your mind and create again from a different blueprint.

Copilot AI review requested due to automatic review settings May 4, 2026 08:57
@claude
Copy link
Copy Markdown

claude Bot commented May 4, 2026

Claude finished @nielslyngsoe's task in 1m 27s —— View job


PR Review

Target: origin/release/17.4.0 · Based on commit: a66769a42b64b6e53d6e34e11b68bba53746d869 · Skipped: 0 noise files out of 1 total

Adds a resetState() call before scaffolding from a blueprint, fixing stale workspace state when a user switches blueprints mid-flow, plus loading state bookends around the async fetch.

  • Other changes: Workspace state is now reset whenever create() is called with a blueprintUnique — this is a behavioral change that fixes the bug (stale scaffold data from a previous blueprint selection is cleared).

Suggestions

  • document-workspace.context.ts:244-254: loading.removeState('blueprint-fetch') is duplicated across two exit paths. If scaffoldByUnique were to throw (e.g., unexpected exception), the loading state would never be cleared. A try/finally block is more robust:

    this.loading.addState({ unique: 'blueprint-fetch' });
    try {
        const { data } = await blueprintRepository.scaffoldByUnique(blueprintUnique);
        if (!data) throw new Error('Blueprint data is missing');
        return this.createScaffold({ ... });
    } finally {
        this.loading.removeState('blueprint-fetch');
    }

Approved

The fix is correct and well-scoped. resetState() is the key change needed to clear stale scaffold state between blueprint selections, and the loading state is properly managed on both exit paths. The try/finally refactor is a nice-to-have for robustness, but the current code is functionally safe given Umbraco's data-flow pattern (repositories return { data, error } rather than throwing).

Applied labels: area/frontend, category/ux

@claude claude Bot added the category/ux User experience label May 4, 2026
@nielslyngsoe nielslyngsoe enabled auto-merge (squash) May 4, 2026 09:01
@nielslyngsoe nielslyngsoe requested a review from AndyButland May 4, 2026 09:01
Copy link
Copy Markdown
Contributor

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.

Pull request overview

Fixes an intermittent blank/grey workspace when creating documents from blueprints by resetting workspace state and showing a loading state before fetching the blueprint scaffold, reducing the race window described in #21996.

Changes:

  • Reset document workspace state earlier when creating from a blueprint.
  • Add/remove a dedicated loading state around the blueprint scaffold fetch.
  • Ensure loading state is removed before throwing when blueprint data is missing.

@nielslyngsoe nielslyngsoe added the release/no-notes Not directly part of the release (updating README, build scripts, tests, etc.) label May 4, 2026
@nielslyngsoe nielslyngsoe merged commit bbebb07 into release/17.4.0 May 4, 2026
39 checks passed
@nielslyngsoe nielslyngsoe deleted the v17/hotfix/21996-new-from-blueprint-v2 branch May 4, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend category/ux User experience release/no-notes Not directly part of the release (updating README, build scripts, tests, etc.) release/17.4.0-rc2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants