Fix false conflict detection when revisionHistory is empty#520
Open
zorox-106 wants to merge 1 commit intotheatre-js:mainfrom
Open
Fix false conflict detection when revisionHistory is empty#520zorox-106 wants to merge 1 commit intotheatre-js:mainfrom
zorox-106 wants to merge 1 commit intotheatre-js:mainfrom
Conversation
When a project's revisionHistory is empty (the default for new projects), initialiseProjectState was incorrectly detecting conflicts. This happened because onDiskState.revisionHistory[0] returned undefined, and indexOf(undefined) always returned -1, triggering the conflict warning. This fix adds a check to ensure the revision exists before performing the lookup, preventing false conflicts while preserving existing behavior for projects with actual revision histories.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Fixes #514 (reported by @White-Devil2839)
Problem: New projects with empty revisionHistory (the default) incorrectly show "Browser state is not based on disk state" warning on every reload.
Cause: onDiskState.revisionHistory[0] returns undefined when empty, and indexOf(undefined) always returns -1, triggering false conflicts.
Fix: Added check for undefined before performing revision lookup in
initialiseProjectState.ts
.
Changed file:
packages/core/src/projects/initialiseProjectState.ts