Skip to content

Stale errors for a few minutes after switching branches聽#44066

Description

Bug Report

馃攷 Search Terms

performance vs code stale error switch branches git

馃晽 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about code editing

馃捇 Code

Video demonstration: https://www.loom.com/share/b8accd596ea74f16ae41f524e6e1497f
TS server log: tsserver.log

  1. Clone and checkout https://github.com/unsplash/unsplash-web/tree/typescript-stale-errors-a, branch typescript-stale-errors-a. This is a private repository but I believe some members of the TS team already have access from debugging previous issues. If you don't have access, please send me your email address so I can provide access (TS team members only).
  2. Run yarn
  3. Open VS Code and navigate to app/routes/Users/components/UserStatsSubRoute/UserStatsSubRoute.tsx
  4. Wait for VS Code to finish initialising TS (no errors)
  5. Switch branches: git checkout typescript-stale-errors-b

馃檨 Actual behavior

Stale errors in the open file for about 2 minutes.

馃檪 Expected behavior

  • No stale errors.
  • Some indication that TypeScript is updating in the background.
  • The update shouldn't take 2 minutes. Restarting TS server only takes ~20 seconds in comparison.

Related: microsoft/vscode#122928

Activity

  1. sheetalkamat commented on May 3, 2022

    @sheetalkamat
    Member

    Oliver Joseph Ash (@OliverJAsh) The branch is no longer available. Are you still seeing the issue. If yes can you please provide the steps to repro
    Thanks

  2. removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    RescheduledThis issue was previously scheduled to an earlier milestone
    on May 3, 2022
  3. 5 remaining items

  4. added
    Needs InvestigationThis issue needs a team member to investigate its status.
    and removed
    Needs More InfoThe issue still hasn't been fully clarified
    on May 4, 2022
  5. sheetalkamat commented on May 4, 2022

    @sheetalkamat
    Member

    Oliver Joseph Ash (@OliverJAsh) thank you for the repro.

    While investigating this the root cause of this is that we poll 32 files at a time every 2 seconds. Since your project has 2000+ files being watched it takes a while for it to show up. At this point this looks working as intended.

  6. added
    Working as IntendedThe behavior described is the intended behavior; this is not a bug
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on May 4, 2022
  7. OliverJAsh commented on May 4, 2022

    @OliverJAsh
    ContributorAuthor

    Is there anything that could be done to improve the user experience? It seems quite extreme to wait this long for TS to fully update. To workaround this I have to restart the TS server very often.

    Note that if I add these VS Code settings the issue disappears, i.e. there are no stale errors when I switch branch:

        "typescript.tsserver.watchOptions": {
            "watchFile": "useFsEvents",
            "watchDirectory": "useFsEvents"
        },

    Perhaps this should be the default?

  8. sheetalkamat commented on May 5, 2022

    @sheetalkamat
    Member

    I am trying to fix some of the issues with using file system watching since they are not reliable. After fix for #47466 , we could consider that but after we have tried it out. Eg. linux has some limit on number of file system watchers it can create.. Then there is non reliability because of watching inode.. though fix for #47466 will make it better but we will have to see how the experience is with that one.

  9. OliverJAsh commented on May 5, 2022

    @OliverJAsh
    ContributorAuthor

    In that case should we keep this issue open to track the user experience issue?

  10. typescript-bot commented on May 7, 2022

    @typescript-bot
    Contributor

    This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  11. OliverJAsh commented on May 25, 2022

    @OliverJAsh
    ContributorAuthor

    I understand this is working as intended but I think there is still a usability issue here. Can we re-open this to track that?

  12. OliverJAsh commented on Sep 9, 2022

    @OliverJAsh
    ContributorAuthor

    Sheetal Nandi (@sheetalkamat) I just tested this again using TS 4.8 which includes #48997, the fix for #47466 which is mentioned above. Unfortunately the issue persists鈥攊t still takes 2 minutes for the stale errors to disappear. Do you think we could re-open this issue and discuss ways to improve the user experience?

    As I mentioned above, if I add these VS Code settings the issue disappears, i.e. there are no stale errors when I switch branch. Do you think we could consider making these settings the default now that #47466 has been addresssed?

        "typescript.tsserver.watchOptions": {
            "watchFile": "useFsEvents",
            "watchDirectory": "useFsEvents"
        },

    Let me know if you need an updated repro that uses TS 4.8.

  13. sheetalkamat commented on Sep 9, 2022

    @sheetalkamat
    Member

    4.8 fix was more towards linux which was one of the blocker to make useFsEvents default.

    useFsEvents is default now with #50366 and is in nightly.
    Daniel Rosenwasser (@DanielRosenwasser) is looking to see if we could get this as experiment in vscode for 4.8 users but it may take some time to get everything together or not work out at all. Mean time nightly will give you that experience.

  14. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Working as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions