Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox Page Reload Bug #2092

Open
Verox001 opened this issue Nov 15, 2024 · 0 comments
Open

Firefox Page Reload Bug #2092

Verox001 opened this issue Nov 15, 2024 · 0 comments
Labels
react Related to the react adapter

Comments

@Verox001
Copy link

Version:

  • @inertiajs/react version: 1.2.0

Describe the problem:

Everytime when I'm trying to access my page via Firefox without having cached anything, the page reloads quickly a few times or so, which is really annoying. It both happens locally and in production, but only on Firefox.

Steps to reproduce:

Setup an Inertia application (I'm using Laravel with these configs):
vite.config.ts

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
    plugins: [
        laravel({
            input: 'resources/scripts/app.tsx',
            ssr: 'resources/scripts/ssr.tsx',
            refresh: true,
        }),
        react()
    ],
    resolve: {
        alias: {
            '@': '/resources/scripts',
        },
    },
    server: {
        hmr: {
            protocol: process.env.DDEV_HOSTNAME ? "wss" : "ws",
            host: `${process.env.DDEV_HOSTNAME ?? "localhost"}`,
        }
    }
});

app.tsx:

import './bootstrap';
import '../css/app.css';

import {createRoot} from 'react-dom/client';
import {createInertiaApp} from '@inertiajs/react';
import {resolvePageComponent} from 'laravel-vite-plugin/inertia-helpers';
import '@fontsource/source-sans-pro/300.css';
import '@fontsource/source-sans-pro/400.css';
import '@fontsource/source-sans-pro/600.css';
import '@fontsource/source-sans-pro/700.css';

// Fonts
import '@fontsource/lato/300.css';
import '@fontsource/lato/400.css';
import '@fontsource/lato/700.css';
import {PageProps} from "@/types";

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

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.tsx`, import.meta.glob('./Pages/**/*.tsx')),
    setup({el, App, props}) {
        const root = createRoot(el);

        root.render(
            <App {...props} />
        );
    },
    progress: {
        color: '#00a6a8'
    },
});

Try accessing the site over Firefox an you'll notice the weird reloading hehaviour. (You can use any React component for testing)

If you need any more details or if anyone else has this issue, please let us know!

@Verox001 Verox001 added the react Related to the react adapter label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react Related to the react adapter
Projects
None yet
Development

No branches or pull requests

1 participant