Skip to content

Commit

Permalink
[SLWP] No need to fetch UPRN when partial loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Apr 9, 2024
1 parent 5b09155 commit a20a343
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ sub property : Chained('/') : PathPart('waste') : CaptureArgs(1) {
my $loading = ($c->req->{headers}->{'hx-request'} || "") eq "true";
# non-JS page loads include a page_loading=1 request param
$loading ||= $c->get_param('page_loading');
$c->stash->{partial_loading} = $loading;

if ( $c->req->path =~ m#^waste/[:\w %]+$#i && !$loading) {
$c->cobrand->call_hook( clear_cached_lookups_property => $id );
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Roles/CobrandSLWP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ around look_up_property => sub {
my $data = $orig->($self, $id);

my $cfg = $self->feature('echo');
if ($cfg->{nlpg} && $data->{uprn}) {
if ($cfg->{nlpg} && $data->{uprn} && !$self->{c}->stash->{partial_loading}) {
my $uprn_data = get(sprintf($cfg->{nlpg}, $data->{uprn}));
$uprn_data = JSON::MaybeXS->new->decode($uprn_data) if $uprn_data;
if (!$uprn_data || $uprn_data->{results}[0]{LPI}{LOCAL_CUSTODIAN_CODE_DESCRIPTION} ne $self->lpi_value) {
Expand Down

0 comments on commit a20a343

Please sign in to comment.