Web Feature Parity #7970
Replies: 3 comments 2 replies
-
IndexDB seems to be the better choice, just on the storage size alone. HOWEVER, on the export topic and index db, why don't we just use the user's file system directly for the web app too? ![]() https://developer.chrome.com/blog/persistent-permissions-for-the-file-system-access-api Anyway just wanted to make sure we consided this path as well.
The move here might be to remove temporary workspaces. I thought a large part of the motivation of the temporary workspace was interwoven with the limitations of the web app, that there one only one file and one project. We can make the links for opening a sample, just create a new project, no temprary workspace needed? |
Beta Was this translation helpful? Give feedback.
-
Indeed they are. I might have test Stockholm syndrome, but I was relieved to see [it's only used in 14 test files](https://github.com/search?q=repo:KittyCAD/modeling-app%20setItem('persistCode'&type=code) |
Beta Was this translation helpful? Give feedback.
-
Great write up @nadr0, thanks! Would love to talk more about these building blocks and how they could enable something like #7607, as I still have trouble seeing the value provided by the web app working only in a specific browser's local storage (or indexdb), beyond just a demo? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. Background
We share the same codebase for deskop and web but there are a few locations that there is no feature parity between web and desktop. To improve the experience for web users we should implement more feature parity between desktop and web.
2. Goals
2.1 Home page support
We should be able to route to
/home
Project
andFileEntry
interface within@src/lib/project
when reading from the indexedDBSystemIOMachineWeb.ts
to generate this data since the application uses this to find the projects.2.2 Choose a web backend for local file storage
Localstorage and indexeddb at the two possible choices. Localstorage stores less and is sync which could lead to performance problems if we are writing a large file in the browser. Indexddb allows for more storage and async operations which the async read/write could lead to better performance when using the application.
I am leaning towards a TS supported indexdeddb library for the implementation of a web based file system. This could mimic more than the project/files structure. It could even store a settings.toml file even though we have that in localstorage.
Technical considerations for
window.localStorage
andIndexedDB API
window.localStorage
Benefits
Limitations
IndexedDB API
Benefits
Limitations
2.3 Command bar project actions
We should be able to support multiple project command actions within the command bar.
2.4 Project files pane
We should be able to support the projects file pane
2.5 Text-To-CAD modify/create multiple files
Text-To-CAD operations should work with the multiple files.
3. Providers
3.1 Implement a SystemIOWebMachine provider
The SystemIOWebMachine can implement the web based way of accessing files and interacting with the project data. This could point to a indexeddb TS library. Many of the project actions are pointing to the SystemIOMachine, if one is hooked up to the web it should be able to be populated.
4. Open Questions
4.1 Do we mimic the entire FS system from desktop into the browser with our indexeddb solution?
settings.toml
exists in the localstorage. Would it make sense to make that a file within the indexeddb and read/write it like we do the desktop or use localstorage?e.g. Oh you need to write that value to settings.toml! If you are on desktop you would know you have a file on disk. If you are on web it is actually an object in localstorage. Would it be better to know that it is a file in web? How should we think about these abstractions.
5. Security Considerations
6. Gotchas
6.1 Any parts of the system that are hard coded for desktop workflows
For example, clicking a project card has code that only runs on desktop because the router path is encoded for a desktop URL not a browser URL. There maybe more of these scenarios to update.
6.2 Unit testing / Playwright tests
They are probably directly interfacing with
localStorage.getItem('persistCode')
orsetItem
.6.3 Other desktop files are in
localStorage
, do those need to be migrated?settings.toml
or aproject.toml
exist on disk on the desktop application. Those are implemented throughlocalStorage
in the web. In the future those could be "files" through indexeddb but that workflow could stay the same for now.The proposal for indexeddb would be for project folders and files for the initial bodies of work.
localStorage
can make sense for certain pieces of data and I don't want to do busy work to migrate everything to the same pattern initially if there isn't much benefit.Moving kcl files from localStorage to indexeddb has more pros. Moving a
settings.toml
to indexeddb` doesn't seem to have much of a benefit?6.4 How would we implement a
project.toml
in web?I'll have to see how this is implemented. If this is similar to a singular
settings.toml
thenproject.toml
may get lumped into the indexeddb body of work so every project can have a project settings file.6.5 How would this interact with temporary workspaces?
Temporary workspaces were made to someone could share a link and not overwrite their previous code to take a look at the link. We could allow share urls to make new projects so we do not need temporary workspaces anymore?
7. Diagrams
External References
Beta Was this translation helpful? Give feedback.
All reactions