Skip to content

Objects updated from controller are outdated in templates/snippets #2559

@lukasbestle

Description

@lukasbestle

Describe the bug

If an object is updated from a controller:

return function($kirby, $page) {
    $kirby->impersonate('kirby');
    $page = $page->update(['test' => uniqid()]);

    return [
        'page' => $page
    ];
};

the updated $page is not available in the template and in snippets as Kirby overrides the returned object with the original $page.

Expected behavior

The updated $page should be provided to the template and snippet. It would be awesome if this would automatically happen even if $page is not manually returned from the controller.

Kirby Version

3.3.5

Additional context

Original discussion in #2555.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions