Unusual full page reload when clicking nav links Hey everyone, I have a weird behavior during clicking my navigation links or another buttons
Sometimes after clicking I see full page reload and I need to click again to make it do the action.
For example, I have those buttons in dropdown for navigation:
<li><a href="{{ route('recipes.index') }}"</a></li>
<li><a href="#authors">Authors</a></li>
<li><a href="{{ route('basics') }}">Basics</a></li>
<li><a href="{{ route('recipes.create') }}">Add recipe</a></li>
and after clicking one of them I see full page reload. And I see this behavior not only for those links but for anothers. Does someone encountered such problem?
Would be grateful for your help
Best regards
does this happen locally using Herd or something else?
I am using Wampserver as a webserver, and yeah, I am on local development now
What is in actual HTML, not in blade files? Any unwanted JS click handlers?
In my layout file I have those scripts:
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected] /dist/flowbite.min.js"></script>
<script type="module" src="https://unpkg.com/[email protected] /dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected] /dist/ionicons/ionicons.js"></script>
My whole layout file looks like this:
I am using Laravel 11.x
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon" type="image/x-icon" href="https://i.ibb.co/vPsLc1c/gourmania-favicon.png">
<title>{{ config('app.name') }} | @yield('title')</title>
{{-- Inknut Antiqua --}}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inknut+Antiqua:wght@300;400;500;600;700;800;900&family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
{{-- Inclusive Sans --}}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inclusive+Sans:ital@0;1&display=swap" rel="stylesheet">
{{-- Inria Serif --}}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inria+Serif:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap" rel="stylesheet">
@vite('resources/css/app.css')
@livewireStyles
</head>
<body>
{{-- Header --}}
<x-header/>
<div class="flex flex-col min-h-screen">
{{-- Main page --}}
<main class="flex-grow">
{{ $slot }}
</main>
{{-- Footer --}}
<x-footer/>
</div>
<x-ui.scroll-to-top/>
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected] /dist/flowbite.min.js"></script>
<script type="module" src="https://unpkg.com/[email protected] /dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected] /dist/ionicons/ionicons.js"></script>
@livewireScripts
</body>
</html>
The first link is broken HTML. Its opening tag is never closed:
-<li><a href="{{ route('recipes.index') }}"</a></li>
+<li><a href="{{ route('recipes.index') }}"></a></li>
It also has no anchor text, so it'll be invisible.
I have this behavior with Livewire.
Are you using Livewire too for this project ?
I think that you notice this behavior when you change some code on your Livewire components, then you go back to the browser and you click on a link, you have a full page reload instead of the link action, and then you need to click once again on the link to trigger the link action.
I have the same behavior and ... well ... I don't worry about, it's only in development and not in production.
Oh got it, I am gonna deploy the project and check the behaviour
Sorry for delay and thanks for the reply
Best regards
Please sign in or create an account to participate in this conversation.