-
Notifications
You must be signed in to change notification settings - Fork 0
Update preference management #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! Some of my thoughts below.
flow: check if the key generated by makeMapKey is already in zoneFavorites. If so, delete entry from favorites. If not, add entry to favorites. The entry is in the same format as the zones in the "uber" map. Then, save the updated favorites to the backend. This is also in the same format as the zones in the "uber" map.
required so that PreferencesProvider can access the zone and file share paths 'uber' map
@krokicki The zone favorites should now be working on this branch. I decided to move forward with saving the zone favorite data in the same format at the |
Hi @allison-truhlar, The reason for the expanded format was to make it easier to reconstitute the data. If you only have the key then you have to parse it (i.e. split on underscores). It will work to use the keys, but it introduces fragility and certain limitations. For example, it prevents the use of underscores in the values moving forward. By the way, I was able to build the branch, but I can't see the file share paths. They seem to load fine in the console, and the zones are displayed, but it seems like they're all empty: Also, it's still saving the entire object as a preference. The idea was to save as little information as possible, to avoid having data in multiple places that can be desynced, and also for efficiency. Here, the preference should just be either |
…tter reflect what the function does
…ently displayed name for fsps and folders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it was the merge, but there are several things broken. I fixed one syntax issue, but there are a few in FavoritesBrowser that I can't resolve (it uses the type FolderFavorite
which is not defined anywhere).
These issues are being caught if you run npm run eslint:check
but for some reason we're not running that in the CI. We should probably enable that and prettier and make a habit of using both before pushing code (or even add a precommit).
@krokicki @neomorphic
This PR is now ready for review. I can wait to fully merge it until I integrate the build changes from Jody.
The main change is adding the construction of the "uber map" in
FileBrowserContext.tsx
and updating the preference management to store hash keys. The format for these keys is the same as in the "uber map" for zones (zone_{fsp.zone}
) and FSPs (fsp_{fsp.name}
). The folder preference key format isfolder_{fsp.name}_{folder.path}
. In addition to being used to access zones and fsps for the favorites, the "uber map" is now also used for populating theZoneBrowser
.I also updated some types/types names in
shared.types.ts
, most notablyFile
toFileOrFolder
, since that's a more accurate description and also avoids the error that would sometimes occur if I forgot to import theFile
type, and the built-in JS interfaceFile
would be assigned as the type.