Veritula – Meta

Showing only #2630 and its comments.

See full discussion
  Log in or sign up to participate in this discussion.
With an account, you can revise, criticize, and comment on ideas.

Discussions can branch out indefinitely. Zoom out for the bird’s-eye view.
Dennis Hackethal’s avatar
Dennis HackethalOP revised about 2 months ago·#2630
2nd of 2 versions

Discussions are getting slower to render as they grow. It’s a rendering issue (not a db issue).

CriticismCriticized1Archived
Dennis Hackethal’s avatar
Dennis HackethalOP revised about 2 months ago·#2633
2nd of 2 versions

I could cache ideas so deeply nested trees can be rendered at once.

Criticized3
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2638

Cache invalidation for user-based caching sounds like a nightmare.

Criticism of #2633
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2640

Initial page loads would still be slow for users.

Criticism of #2633
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2641

A single new idea somewhere down the tree could invalidate the cache and slow things down again.

Criticism of #2633
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2635

I could lazy load ideas: only load the parts of the page that would be visible on the current viewport. Then load more parts as the user scrolls.

Criticized2
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2657

Complex, requires non-trivial scroll listeners correlated to deeply nested ideas.

Criticism of #2635
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2678

That means cmd + f won’t always work.

Criticism of #2635
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2636

On initial page load, I could just load the first ten or so top-level ideas and their immediate children, just to reduce wait times and populate the page. Then load the rest asynchronously.

Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2685

Duplicate of #2677/#2683.

Criticism of #2636
Dennis Hackethal’s avatar
Dennis HackethalOP revised about 2 months ago·#2659
2nd of 2 versions

I could use ActionController::Live to stream top-level ideas to the page one by one. Instant page load.

Battle tested
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2647

Including that module significantly slows down hot reloads on all pages. I need a tight feedback loop in dev.

Criticism of #2659Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2648

Fast UX is more important than fast developer experience.

Criticism of #2647Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2649

A slow developer experience will slow down all further development, including bug fixes and feature rollouts, which hurts UX as well.

Criticism of #2648
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2650

After resetting my working directory and beginning to implement streams a second time, I can no longer reproduce this issue, despite reasonable attempts to reproduce it.

Criticism of #2647Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2651

I’ve since been able to reproduce the issue after all. Running a raw SQL query in Idea.tree in combination with the inclusion of the Live module seems to mess with Rails’s reloader.

Criticism of #2650
Dennis Hackethal’s avatar
Dennis HackethalOP, about 2 months ago·#2652

Replacing a raw SQL query in Idea.tree with a standard ActiveRecord query solves this issue.

Criticism of #2647
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2668

This page used to take ~3.5 seconds to load. Now it renders within 600ms :)

Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2670

Incompatible with Devise authentication: https://github.com/heartcombo/devise/issues/2332

Criticism of #2659Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP revised about 1 month ago·#2688
4th of 4 versions

The thread suggests a workaround: use authenticated do … blocks in routes.rb instead of before_action :authenticate_user! in controllers.

It’s probably a good idea to do this anyway to avoid divulging the existence of routes that unauthenticated users don’t need to know exist. (They will get a 404 instead of a 401.)

Criticism of #2670Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2690

Then again, I’d want to redirect users to the sign-in page (and then ideally back to where they were trying to go).

Criticism of #2688
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2691

I could extract discussions#show into a new, separate StreamController or something like it. That controller would not use Devise.

Criticism of #2670
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2692

I could override authenticate_user! in the DiscussionsController.

Criticism of #2670Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2693

That means duplicate functionality; anytime I customize Devise in the future, I’ll have to remember to adjust this one method as well.

Criticism of #2692
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2671

JS modules are always deferred and unusable until the page is fully loaded. As a result, comment buttons and gutters won’t work while ideas are still streaming onto the page.

Criticism of #2659Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2694

I now purposely prevent interactions with buttons and gutters, and gray them out, until the page is fully loaded. So instead of broken hover effects and interactions, the user gets intentionally disabled elements, and this intentionality is communicated to them.

Once the page is fully loaded, buttons and gutters are enabled and visually restored.

Since the browser’s loading indicator remains visible until then, this behavior shouldn’t violate user expectation.

Criticism of #2671
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2679

cmd + f won’t work reliably.

Criticism of #2659Criticized2
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2695

Now that parts of the page are purposely and visually disabled (see #2694), users may not expect everything to be working 100% during a loading state.

Criticism of #2679
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2696

This problem will surface rarely – users would have to hit cmd + f immediately upon opening the page. For most users, by the time they start typing, the page is already fully loaded. So this seems like a small price to pay in exchange for discussion pages that always render faster.

Criticism of #2679
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2675

I could have a separate route at /ideas/:id/isolated which renders only the idea without any parents or children. And then a discussion could render a bunch of deeply nested turbo frames loading that route.

Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2676

For large discussions, wouldn’t that flood the server with requests?

Criticism of #2675
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2682

Yes, it would be even worse than #2677 (see criticism #2681), where only top-level ideas were turbo frames.

Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2677

The top level ideas could be rendered as turbo frames of ideas#show.

Criticized2
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2680

I just tried this. Seemed promising at first but sometimes ideas load out of order. Looks horrible.

Criticism of #2677Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2683

I could render the first ~10 top-level ideas immediately and only render the rest as turbo frames off screen. By the time the user scrolls down, they should all be loaded.

Criticism of #2680
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2681

Too many requests when there are enough top-level ideas.

Criticism of #2677
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2684

While ideas load, cmd +f won’t work.

Criticism of #2677
Dennis Hackethal’s avatar
Dennis HackethalOP, about 1 month ago·#2723

I implemented #2659 and it’s much better now. In addition, there is now automated archiving (#2704) and manual archiving (#2711). Archived ideas live on a separate page, so the main page is faster.

Criticism of #2630