Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Persist recently used blocks, and record block usage #2836
Loading up a new post populated the recently used blocks with
This also keeps a "highscore table" of block usage, so in
How Has This Been Tested?
Add some blocks to a post, they should appear at the
Start a new post, or load an existing post, and the blocks in
Types of changes
New feature (non-breaking change which adds functionality)
@@ Coverage Diff @@ ## master #2836 +/- ## ========================================= - Coverage 33.77% 33.58% -0.2% ========================================= Files 191 191 Lines 5691 5810 +119 Branches 996 1023 +27 ========================================= + Hits 1922 1951 +29 - Misses 3189 3259 +70 - Partials 580 600 +20
Really nice work, thanks for working on this.
Took the branch for a spin, did this:
This felt expected, very nice! Then created a new post, saw the Latest Posts block sorted not at first, like it was previously. That was a bit confusing.
This sounds right to me. That is — if I keep using the "Recent Posts" block, it will ride up the "highscore list" all the way to the top.
The key here is that the recent lists changes per your usage, but persists so it's "the same" in between posts, and only changes when you actually use other blocks.
Does that make sense? Did I grok this right?
@jasmussen it's a little bit more subtle...
We can't use the "highscore" by itself. The problem is, if we have 8 blocks we use a lot, then we use one we've never used before, it won't have a score high enough to appear in the list.
If we use the "last used time" by itself, then the list becomes purely a list of what we've used recently, with most recent at the top, which I think is what people are expecting, although the list would change order depending on what blocks you've used most recently. However, this is exactly how a "recently opened documents" list works, so perhaps what people expect.
From the feedback I'm getting here, it seems like the "highscore" isn't of any use, and we should just be persisting the list based on when blocks were last used.
I really think that we just persist the recently used state. Mixing the highscore table and the recently used state is just confusing.
HOWEVER, I think it's still worth keeping the highscore table (adopting that term, I like it haha) because the quick links next to the inserter icon (currently for paragraph and image) could be generated by the blocks a user most frequently uses, but that can come in a future PR.
I've changed this around now so it only uses the blocks you have used recently for the recently used blocks tab, displaying them with most recent at the top.
The block usage highscore is still in there, once we're happy with this branch and it's merged, I'll do a separate PR for the frequently used blocks to appear next to the inserter, where paragraph and image currently are.