Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: async public key loading

Andras Bacsai7a92ecfa30fa
diff --git a/app/Livewire/Security/PrivateKey/Show.php b/app/Livewire/Security/PrivateKey/Show.php
index 0540b2e293..0a292731b3 100644
--- a/app/Livewire/Security/PrivateKey/Show.php
+++ b/app/Livewire/Security/PrivateKey/Show.php
@@ -8,7 +8,7 @@ use Livewire\Component;
class Show extends Component
{
public PrivateKey $private_key;
- public $public_key;
+ public $public_key = "Loading...";
protected $rules = [
'private_key.name' => 'required|string',
'private_key.description' => 'nullable|string',
@@ -25,11 +25,13 @@ class Show extends Component
{
try {
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
- $this->public_key = $this->private_key->publicKey();
}catch(\Throwable $e) {
return handleError($e, $this);
}
}
+ public function loadPublicKey() {
+ $this->public_key = $this->private_key->publicKey();
+ }
public function delete()
{
try {
diff --git a/resources/views/livewire/security/private-key/show.blade.php b/resources/views/livewire/security/private-key/show.blade.php
index b56fab610a..9935f55652 100644
--- a/resources/views/livewire/security/private-key/show.blade.php
+++ b/resources/views/livewire/security/private-key/show.blade.php
@@ -1,4 +1,4 @@
-<div>
+<div x-init="$wire.loadPublicKey()">
<x-security.navbar />
<div x-data="{ showPrivateKey: false }">
<form class="flex flex-col gap-2" wire:submit='changePrivateKey'>
@@ -22,11 +22,11 @@
<x-forms.input readonly id="public_key" />
<div class="flex items-end gap-2 py-2 ">
<div class="pl-1 ">Private Key <span class='text-helper'>*</span></div>
- <div class="text-xs dark:text-white underline cursor-pointer" x-cloak x-show="!showPrivateKey"
+ <div class="text-xs underline cursor-pointer dark:text-white" x-cloak x-show="!showPrivateKey"
x-on:click="showPrivateKey = true">
Edit
</div>
- <div class="text-xs dark:text-white underline cursor-pointer" x-cloak x-show="showPrivateKey"
+ <div class="text-xs underline cursor-pointer dark:text-white" x-cloak x-show="showPrivateKey"
x-on:click="showPrivateKey = false">
Hide
</div>