Skip to content

Fix file state loss on page refresh (#5450)#5480

Open
anandjha249 wants to merge 1 commit intopterodactyl:1.0-developfrom
anandjha249:fix-file-state-refresh-5450
Open

Fix file state loss on page refresh (#5450)#5480
anandjha249 wants to merge 1 commit intopterodactyl:1.0-developfrom
anandjha249:fix-file-state-refresh-5450

Conversation

@anandjha249
Copy link

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
Copy link
Author

(ignore)

wdym?

@voidvalue-dev
Copy link
Contributor

(ignore)

wdym?

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

@anandjha249
Copy link
Author

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

@voidvalue-dev
Copy link
Contributor

voidvalue-dev commented Dec 30, 2025

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 #5480"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File state is lost when refreshing the page

2 participants