Skip to content

Load selected comment before loading every comment

Simon Knox requested to merge psi-instant-notes into master

What does this MR do and why?

Makes loading a link to a note faster. Load a single note first if there is a note_* in URL, put it in the middle of skeleton loaded notes.

What doesn't it do

  • Currently only works for issues (work_items coming next)
  • Causes minor jump-to-the-right for replies (doesn't currently fetch discussion info so can't be sure if a reply or not)

Screenshots or screen recordings

outputs

How to set up and validate locally

  1. Make an issue with a lot of notes. Rails console script to add 200 comments to the last issue then print link to it:

    issue = Issue.last
    
    200.times do |i|
     issue.notes.create!(
       note: "This is comment #{i + 1} with some words in it to pad out the page and try to mess with the scroll position or just to give you something to read while it loads.",
       project: issue.project,
       author: User.first
     )
    end
    
    puts "URL: #{Gitlab.config.gitlab.url}/#{issue.project.full_path}/issues/#{issue.iid}"
  2. test out things to break it and find bugs. Sort comments by date ascending/descending, scroll the page while still loading, add some large images or diagrams to notes near the preview note

Edited by Simon Knox

Merge request reports

Loading