panel icon indicating copy to clipboard operation
panel copied to clipboard

Fix file state loss on page refresh (#5450)

Open anandjha249 opened this issue 11 months ago • 4 comments

Fixes

File directory and editor content are lost when refreshing the page while creating a new file. Video: https://imgur.com/PimtXLg (From the original issue thread)

Videos(Fixed)

Video1 : https://imgur.com/a/cWXsI1K Video2 : https://imgur.com/a/IW9aaZV

Closes #5450

Problem

  • Refreshing the page during "New File" creation resets the directory to /
  • Typed content in the editor is lost on refresh

Cause

When action === 'new', the directory state was never initialized from the URL hash, causing it to default to /.

Solution

  • Properly initialize directory state from the URL hash when creating new files
  • Persist unsaved editor content in localStorage and restore it after refresh
  • Automatically clear draft content after a successful save

Scope

  • Applies only to action === 'new'
  • Editing existing files is unaffected

Testing

  • Create new file in subdirectory → refresh → save → file stays in correct directory
  • Editor content is restored after refresh
  • Draft is cleared after saving

Important

  • doesn't chnage anything in backend all changes are frontend/UI only so no major rework is needed

anandjha249 avatar Dec 28 '25 17:12 anandjha249

(ignore)

wdym?

anandjha249 avatar Dec 29 '25 04:12 anandjha249

(ignore)

wdym?

It was because of my message. I didn't remember that it could be deleted

voidvalue-dev avatar Dec 29 '25 14:12 voidvalue-dev

It was because of my message. I didn't remember that it could be deleted

any idea on how long would it take for the checks to be started all are currently in pending state

anandjha249 avatar Dec 29 '25 15:12 anandjha249

It was because of my message. I didn't remember that it could be deleted

any idea on how long would it take for the checks to be started all are currently in pending state

"This workflow is awaiting approval from a maintainer in https://github.com/pterodactyl/panel/pull/5480"

voidvalue-dev avatar Dec 30 '25 21:12 voidvalue-dev