fix: sort project files alphabetically on pull to preserve sidebar order - #181
Open
aronsysdone wants to merge 1 commit into
Open
fix: sort project files alphabetically on pull to preserve sidebar order#181aronsysdone wants to merge 1 commit into
aronsysdone wants to merge 1 commit into
Conversation
Fixes an issue where pulling modified files from GitHub/SCM alters the file ordering in Google Apps Script. During a pull, modified files are concatenated ahead of unchanged files (`updatedFiles.concat(remainedFiles)`), placing modified items at the top of the array payload. Because Google Apps Script renders the IDE sidebar strictly based on array index position in the manifest, updated files were permanently pushed to the top of the sidebar. This change sorts the concatenated `files` array alphabetically before sending the PUT request, keeping the `appsscript` manifest at index 0.
Author
|
Note for the maintainer: The CircleCI build failure is purely infrastructural and completely unrelated to the changes in this patch. The build failed at the initial environment setup step during |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where pulling modified files from GitHub/SCM alters file ordering in Google Apps Script projects.
Cause
During a pull, modified files are concatenated ahead of unchanged files (
updatedFiles.concat(remainedFiles)), placing modified items at the top of the project payload array.Because Google Apps Script uses this internal array sequence for both IDE sidebar rendering and top-level evaluation order, scrambling the array index is not just cosmetic—it can cause runtime errors (such as
ReferenceErrorwhen global scope code depends on files expected to load first).Fix
Sorts the concatenated
filesarray alphabetically before sending thePUTrequest, keeping theappsscriptmanifest at index 0 to ensure deterministic execution order and consistent sidebar layout.