Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Corronica's avatar

<Link> tag isnt working

Hi all I was redirected here from the vue forum, im following Lukes guide on building a forum from scratch on Episode 8 he use pagination and a Link instead of an a ive been looking through his github for discrepancies and mine but I can't find anything the page goes white when I try to use the Link template and I can't see anything when its the a it works fine any help would be great here is the source for app.js and the Pagination.vue I tried imports into app.js as well but they didn't work unless I wasn't doing them right.

Here is the error in the console

Uncaught (in promise) TypeError: e.href is null

I think it may be this line but dont know how to fix it

v-for="link in meta.links"
import '../css/app.css';

import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy';

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(ZiggyVue)
            .mount(el);
    },
    progress: {
        color: '#4B5563',
    },
});
0 likes
7 replies
LaryAI's avatar
Level 58

It looks like you're experiencing an issue with the <Link> component from Inertia.js in your Vue 3 application. When the page goes white, it often indicates a JavaScript error. Here are a few steps to troubleshoot and potentially resolve the issue:

  1. Ensure Correct Import: Make sure that the <Link> component is correctly imported from @inertiajs/vue3. It seems like you have already done this in your <script setup> block, but double-check for any typos or import issues.

    import { Link } from '@inertiajs/vue3';
    
  2. Check Console for Errors: Open your browser's developer console and look for any error messages. These messages can provide clues about what's going wrong.

  3. Verify meta Object Structure: Ensure that the meta object being passed as a prop contains the expected structure. Specifically, check that meta.links is an array and that each link object has a url property.

  4. Check for Null or Undefined URLs: If any of the link.url values are null or undefined, it could cause issues. You might want to add a check to ensure that the URL is valid before rendering the <Link> component.

    <Link v-for="link in meta.links"
          v-if="link.url"
          :key="link.label"
          :href="link.url"
          class="relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md px-3 py-2"
          :class="{
              'z-10 bg-indigo-600 text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600': link.active,
              'text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-offset-0': !link.active
          }"
          v-html="link.label"
    >
    </Link>
    
  5. Check for Reactive Properties: Ensure that previousUrl and nextUrl are correctly computed and reactive. If props.meta.links is not reactive, it might not update as expected.

  6. Debugging: Add some console.log statements to check the values of meta, previousUrl, and nextUrl to ensure they are what you expect.

  7. Styling Issues: Sometimes, CSS can cause elements to not display as expected. Ensure that your CSS is not inadvertently hiding the content.

If none of these steps resolve the issue, consider creating a minimal reproduction of the problem and checking if the issue persists. This can help isolate the problem and make it easier to debug.

Ben Taylor's avatar

What does the error message in the developer console say?

That's the first place you should ever look when you get a white screen.

Corronica's avatar

@Ben Taylor I have 2 runtime errors

[Vue warn]: Invalid prop: type check failed for prop "href". Expected String | Object, got Null  
  at <Link href=null class="relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50" > 
  at <Pagination meta= 
Object { current_page: 1, from: 1, last_page: 17, links: (15) […], path: "http://localhost/posts", per_page: 15, to: 15, total: 245 }
 class="mt-2" > 
  at <Container> 
  at <AppLayout> 
  at <Index errors= 
Object {  }
 jetstream= 
Object { canCreateTeams: false, canManageTwoFactorAuthentication: true, canUpdatePassword: true, canUpdateProfileInformation: true, hasEmailVerification: true, flash: [], hasAccountDeletionFeatures: true, hasApiFeatures: false, hasTeamFeatures: false, hasTermsAndPrivacyPolicyFeature: false, … }
 auth= 
Object { user: null }
  ... > 
  at <Inertia initialPage= 
Object { component: "Posts/Index", props: {…}, url: "/posts", version: "89faf8b044dcee47b30894942f53d738", clearHistory: false, encryptHistory: false, rememberedState: {} }
 initialComponent= 
Object { __name: "Index", props: (1) […], setup: setup(__props), __hmrId: "e43498fb", render: _sfc_render(_ctx, _cache, $props, $setup, $data, $options)
, __file: "/home/corronica/DogsForum-app/resources/js/Pages/Posts/Index.vue", inheritAttrs: false, … }
 resolveComponent=fn<t>  ... > 
  at <App>
[Vue warn]: Unhandled error during execution of setup function 
  at <Link href=null class="relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50" > 
  at <Pagination meta= 
Object { current_page: 1, from: 1, last_page: 17, links: (15) […], path: "http://localhost/posts", per_page: 15, to: 15, total: 245 }
 class="mt-2" > 
  at <Container> 
  at <AppLayout> 
  at <Index errors= 
Object {  }
 jetstream= 
Object { canCreateTeams: false, canManageTwoFactorAuthentication: true, canUpdatePassword: true, canUpdateProfileInformation: true, hasEmailVerification: true, flash: [], hasAccountDeletionFeatures: true, hasApiFeatures: false, hasTeamFeatures: false, hasTermsAndPrivacyPolicyFeature: false, … }
 auth= 
Object { user: null }
  ... > 
  at <Inertia initialPage= 
Object { component: "Posts/Index", props: {…}, url: "/posts", version: "89faf8b044dcee47b30894942f53d738", clearHistory: false, encryptHistory: false, rememberedState: {} }
 initialComponent= 
Object { __name: "Index", props: (1) […], setup: setup(__props), __hmrId: "e43498fb", render: _sfc_render(_ctx, _cache, $props, $setup, $data, $options)
, __file: "/home/corronica/DogsForum-app/resources/js/Pages/Posts/Index.vue", inheritAttrs: false, … }
 resolveComponent=fn<t>  ... > 
  at <App>

Looks like a null error

Corronica's avatar

@martinbean Please read the first line in the sentence as stated in the replies of that post.

Please or to participate in this conversation.