Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Store/retrieve state from windows that have no opened project #19557

Closed
wants to merge 1 commit into from

Conversation

rafeca
Copy link
Contributor

@rafeca rafeca commented Jun 18, 2019

This PR attempts to solve the root issue that causes the confusion around the "Restore previous window on start" config setting (reported in atom/settings-view#1129).

Problem

The root problem is that in order to store (or retrieve) an editor window state, Atom uses the list of folders that are currently opened as the key. This is a simple approach but has the limitation that cannot be used to store the state when opening a single file or a set of files (as feature which was introduced in #18608).

Solution

In order to fix this, I've introduced the windowId param, which is a unique identifier for each window which is used for storing and retrieving the state of windows that do not have any opened project.

This allows to keep the full state of Atom windows (even if there are many windows without any opened project) when opening Atom without passing any arguments.

Major drawback

There's a big drawback on this solution, which IMHO we need to fix before considering merging it: Since there's no cleaning mechanism on the StateStore (the IndexedDB database which keeps the state of the Atom windows), adding this logic will make its size increase indefinitely, since window identifiers will get generated every time a new Atom window without a project gets created (so e.g every time a user runs atom Readme.md).

This problem is already happening on master, since every time that a user opens a folder on Atom, this folder state will permanently be stored on the IndexedDB database, but with this PR the issue is amplified considerably (specially for people that use Atom to edit single files).

Next steps

As I mention, I don't think this PR is shippable in the current state, but I've sent it anyways to:

  • Gather feedback about the approach and whether it makes sense to invest time on fixing the drawback.
  • If we want to go forward with this solution, I'll let anyone who's willing to fix the drawback to do so. The easiest way to fix it is to make the StateStore a LRU cache.
  • The last step would be to add some tests to this PR 😃

@rafeca rafeca requested a review from smashwilson June 18, 2019 12:28
@rafeca rafeca changed the title Store/retrieve state from windows that have no projects Store/retrieve state from windows that have no opened project Jun 18, 2019
@sadick254
Copy link
Contributor

Hey @rafeca. I see we have conflicts on this PR. I have also noticed that this PR has been open for long. Are you still planning to work on this?

@sadick254
Copy link
Contributor

We haven't gotten a response to our questions in our comment above. I'm going to close this but don't hesitate to reach out if you get time to resolve the conflicts, we'll be happy to reopen the PR.

@sadick254 sadick254 closed this May 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants