Skip to content

Subsequent structured Entry URLs are null due to blink #5046

@jasonvarga

Description

@jasonvarga

Bug description

In a structured collection, if you were to create multiple entries, only the first one will have a URL.

This only occurs on the same request where you create them. Upon refreshing the page, they will all have URLs as expected.

How to reproduce

Have a structured collection, then create some entries.

$a = tap(Entry::make()->collection('pages')->etc())->save();
$b = tap(Entry::make()->collection('pages')->etc())->save();
$c = tap(Entry::make()->collection('pages')->etc())->save();

$a->url(); // outputs the url
$b->url(); // null
$c->url(); // null

Logs

No response

Versions

Statamic 3.2.30

Installation

Other (please explain)

Additional details

This is happening because we blink the tree contents here:

public function tree($tree = null)
{
return $this->fluentlyGetOrSet('tree')
->getter(function ($tree) {
$key = "structure-{$this->handle()}-{$this->locale()}-".md5(json_encode($tree));
return Blink::once($key, function () use ($tree) {
return $this->structure()->validateTree($tree, $this->locale());
});
})
->args(func_get_args());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions