Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Splits sites object in the app state #9979

Closed
wants to merge 1 commit into from

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Jul 12, 2017

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Auditors: @bbondy @ayumi @diracdeltas @bsclifton @darkdh

Test Plan:

  1. Bookmark
  • try to add a bookmark
  1. Bookmark
  • try to add a bookmark, but into the second level folder
  1. Bookmark folder
  • try to add a bookmark folder
  1. Bookmark
  • try to edit a bookmark
  1. Bookmark folder
  • try to add a bookmark folder
  1. Bookmark
  • try to remove a bookmark
  1. Bookmark folder
  • try to remove a bookmark folder
  1. Bookmark
  • try to add a bookmark into a folder (with a right click on a folder)
  • folder should be preselected
  1. Bookmark folder
  • try to add a bookmark folder into a folder (with a right click on a folder)
  • folder should be preselected
  1. Navigation bar
  • try to bookmark a page via navigation bar star
  1. Navigation bar
  • try to edit a bookmark via navigation bar star
  1. Bookmark manager
  • try to add a bookmark folder from a bookmark manager (list, folder tree and button)
  1. Bookmark manager
  • try to add a bookmark from a bookmark manager (list, folder tree and button)
  1. Bookmark manager
  • try to edit a bookmark from a bookmark manager (list and folder tree)
  1. Bookmark manager
  • try to edit a bookmark folder from a bookmark manager (list and folder tree)
  1. Bookmark link
  • try to bookmark a link (right click on a link in the page)
  1. Bookmark manager
  • try to dnd bookmark into another folder
  1. Bookmark manager
  • try to dnd multiple bookmarks into another folder
  1. Bookmark manager
  • try to dnd folder into another folder
  1. Bookmark manager
  • try to reorder bookmarks in bookmark manager
  1. Bookmark toolbar
  • try to dnd bookmark into the folder
  1. Bookmark toolbar
  • try to dnd folder into another folder
  1. Bookmark toolbar
  • try to to reorder bookmarks with dnd (try it with folders as well)
  1. History manager
  • check if history is successfully added
  1. History manager
  • right click on a history item
  • try to delete it
  1. Pinned tabs
  • try to pin a site
  • restart the browser
  • check if pinned tab is still there
  1. Importer
  • try to import HTML file
  1. Importer
  • try to import from chrome
  1. Importer
  • try to import from FF
  1. Exporter
  • check if export is working
  1. Url bar suggestions
  • check if bookmark is shown in suggestion list
  1. Url bar suggestions
  • check if history site is shown in suggestion list
  1. Ledger
  • enabled ledger
  • visit some site
  • check if site is added to the ledger
  1. New tab
  • check if top sites are displayed correctly
  1. New tab
  • check if you can remove top site
  1. New tab
  • check if you can pin top site
  1. New tab
  • check if you can bookmark and edit bookmark already bookmarked top site
  1. New tab
  • check if you can reorder top sites

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@NejcZdovc NejcZdovc added this to the 0.19.x (Developer Channel) milestone Jul 12, 2017
@NejcZdovc NejcZdovc self-assigned this Jul 12, 2017
@NejcZdovc
Copy link
Contributor Author

NejcZdovc commented Jul 12, 2017

Pinned sites

  • create utils
  • create tests for util file
  • create upgrade script

Default sites

  • remove from state
  • refactor newTab to use topSites directly

History sites (current sites object)

  • create utils
  • create index-order table do we need?
  • create tests for util file
  • create upgrade script
  • fix about:history

Bookmarks sites

  • create utils
  • remove customTitle
  • create index-order table
  • create tests for util file
  • create upgrade script
  • fix about:bookmarks
  • try to add a bookmark (star icon) while page is still loading
  • new tab bookmark is not working
  • changing bookmark folder location is not working for already bookmarked item
  • right click on a bookmark and clicking add site deletes all bookmarks

Bookmark folder sites

  • create utils
  • remove customTitle
  • create index-order table
  • create tests for util file
  • create upgrade script

General

  • check how sites (no tags) array is working in other places
  • update sync related code, ask for help from @ayumi @diracdeltas
  • update import related code, ask for help from @darkdh
  • update suggestions related code, ask for help from @bbondy
  • alphabetize state docs
  • keep only general functions in js/state/siteUtil.js
  • remove app/common/state/siteState.js
  • remove app/browser/reducers/sitesReducer.js
  • make sure that import order is preserved
  • go through all getSiteKey calls and see where we can remove them, because key is now inside bookmarks object

Questions

  • can we remove site from sites when we pin it?
  • should we be saving keys in string format? Otherwise every time you want to use key in .get(), you need to add toString()
  • we have last visited time in about:bookmarks. Is this needed? @bradleyrichter if so we need to to update bookmark entry when we add history entry.

Known issues

  • improve import, because now it's taking too long to finish (maybe the problem is that we are calling action inside action)
  • if you add a site via dialog, we need to add favicon somehow if it's not in the history
  • import from chrome is not working
  • sync is not working
  • site cache is broken
  • if you delete a history item and then bookmark active frame you will lose favicon and theme color
  • when importing from chrome last accessed time is not imported correctly
  • add sort values for upgrade process
  • bookmarks don't get favicon if you bookmark top sites on a fresh profile
  • bookmark star status is not displayed correctly on a new tab
  • fix dnd for top sites in new tab
  • more bookmarks doesn't work on bookmark toolbar

Tests

  • app/browser/reducers/bookmarkFoldersReducer.js
  • app/browser/reducers/bookmarksReducer.js
  • app/browser/reducers/historyReducer.js
  • app/browser/reducers/pinnedSitesReducer.js
  • app/browser/reducers/sitesReducer.js (this file was removed, move things around)
  • app/common/cache/bookmarkLocationCache.js (before it was siteCache.js)
  • app/common/cache/bookmarkOrderCache.js
  • app/common/lib/bookmarkFoldersUtil.js
  • app/common/lib/bookmarkUtil.js
  • app/common/lib/historyUtil.js
  • app/common/lib/pinnedSitesUtil.js
  • app/common/state/aboutHistoryState.js
  • app/common/state/aboutNewTabState.js
  • app/common/state/bookmarkFoldersState.js
  • app/common/state/bookmarksState.js
  • app/common/state/historyState.js
  • app/common/state/pinnedSitesState.js
  • app/common/state/tabState.js
  • js/state/siteUtil.js (test file needs to be updated)
  • js/stores/windowStore.js

Possible fixes (check if this issues are fixed after done)

docs/state.md Outdated
@@ -236,7 +236,47 @@ AppStore
'tabs.switch-to-new-tabs': boolean, // true if newly opened tabs should be focused immediately
'tabs.tabs-per-page': number // number of tabs per tab page
},
sites: {
// TODO sort alphabetically
Copy link
Contributor

@ayumi ayumi Jul 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorted collections are not easily possible with Immutable.JS right? and we probably don't want to re-sort on each sites mutation

currently i'm working around this by keeping separate sorted lists of siteKeys & scores (redis-sorted-set) in memory, populated at program init and with each ADD/RE/MOVE _SITE event.

Copy link
Contributor Author

@NejcZdovc NejcZdovc Jul 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this TOD only means that I should reorder this new entities in this md file when all properties are fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding sort, I was thinking of creating simple sort object that would have siteKey and order key. This way we can have bookmarks and folders split, but still keep the order that we need for the bookmark toolbar. Something similar we use for tabs as well.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-sort on every sites mutation has been a source of serious perf issues, so as long as we don't do that it's okay.

i'm actually working on something similar for caching history and topsites. downside is the cache is available in the same process only.

it would be nice if there existed an Immutable.JS sorted map.

@ayumi
Copy link
Contributor

ayumi commented Jul 12, 2017

what's the timeline on this refactor?
currently i'm fixing the last major reducer perf issue (100–200ms / load) by caching history and topSite siteKeys.

@NejcZdovc
Copy link
Contributor Author

Timeline is probably start of the next week

docs/state.md Outdated
title: string
}
},
pinnedSites: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this can be removed and we only use tabs for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need it

@diracdeltas
Copy link
Member

the pinned tab changes won't affect sync, but everything else does. i can help do the sync change

@@ -626,7 +628,8 @@ module.exports.defaultAppState = () => {
pendingRecords: {}
},
locationSiteKeysCache: undefined,
sites: getTopSiteMap(),
sites: getTopSiteMap(), // TODO remove
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen to the top sites? currently they have siteTag DEFAULT so that they don't show up in history/autosuggest until they are actually visited

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out that we only use top sites in new tab, so top sites will be automatically added to the new tab top sites list inside the newTab component. Top sites will not be part of the state anymore.

@NejcZdovc
Copy link
Contributor Author

@diracdeltas thank you, will need some help with sync for sure. Right now I am still building the big picture, so probably tomorrow I will have cleaner image and path how to do everything.

@NejcZdovc NejcZdovc force-pushed the refactor/#9978-sites branch 10 times, most recently from 0ba3c00 to f96e0b1 Compare July 15, 2017 17:35
@NejcZdovc
Copy link
Contributor Author

@ayumi how far are you with your fix?

@NejcZdovc
Copy link
Contributor Author

@luixxiul ok so there could be a problem with an upgrade process. Will take a look

@NejcZdovc NejcZdovc force-pushed the refactor/#9978-sites branch 18 times, most recently from a87b20d to 52ddddb Compare July 25, 2017 15:30
ayumi added a commit that referenced this pull request Jul 25, 2017
@NejcZdovc
Copy link
Contributor Author

Closing in favor of #10136, which is based on this repo and not on my fork.

@NejcZdovc NejcZdovc closed this Jul 26, 2017
ayumi added a commit that referenced this pull request Jul 26, 2017
ayumi added a commit that referenced this pull request Jul 26, 2017
@diracdeltas diracdeltas removed this from the 0.20.x (Developer Channel) milestone Aug 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants