sveltejs / sveltejs/kit

SvelteKit reloads pages and clears form data on mobile

Open
#4,238 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

blocked by upstream p2-nice-to-have vite
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

I have an issue on mobile (iOS/iPhone). I'm developing a form that has text inputs. If I enter some data and swipe to a different app for a short while, when I swipe back to the SvelteKit app, it refreshes the page and clears all the form inputs. Just tested and this even happens if I simply add an input the index.svelte of the skeleton app after a fresh SvelteKit install.

This does not seem to happen with Svelte apps. Only SvelteKit apps.

Mobile ONLY! Desktop apps are fine

Reproduction

Install the skeleton SvelteKit app.
Add an input to the index.svelte page.
Run the app
Enter some data in the form input
Switch to another app
Wait 5+ seconds
Switch back to the SvelteKit app
Watch the form data clear...

Logs

No response

System Info
System:
    OS: macOS 12.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 48.90 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.5.0 - /usr/local/bin/node
    npm: 8.5.1 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 98.1.35.104
    Chrome: 98.0.4758.109
    Firefox: 97.0.1
    Safari: 15.2
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.30 
    @sveltejs/kit: next => 1.0.0-next.292 
    svelte: ^3.44.0 => 3.46.4
Severity

blocking all usage of SvelteKit

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce this in a fresh SvelteKit skeleton app by adding an input to index.svelte, entering text, switching apps on an iPhone, and returning after five seconds. Compare the mobile behavior with a Svelte app and inspect the app lifecycle or reload path involved. Done means returning to the SvelteKit app no longer clears the entered form data.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.