Georg Ledermann PRO
Joined 5/9/2016
Full Stack Web Developer
Georg Ledermann PRO said over 6 years ago on Upgrading Ruby on Rails Versions :

Nice website for doing the diff:

Georg Ledermann PRO said over 5 years ago on What the RegEx? :
Worth mentioning:

Georg Ledermann PRO said about 2 years ago on Infinite Scrolling with Hotwire :
The first drawback of the no-JS approach can be mitigated by this code in the controller:

class PostsController < ApplicationController
  def index    
    respond_to do |format|
      format.turbo_stream { @pagy, @posts = pagy_countless(Post.all) }    

It ensures that posts are loaded for turbo_stream requests only.

Georg Ledermann PRO said about 1 year ago on Push Notifications from Scratch :
Great episode, but while playing with the repo, I get an error in the browser console within Safari 16.3 on MacOS 13.2.1 and the notification does not work:

Notification prompting can only be done from a user gesture.

In other browsers (tested with Edge) there is just a warning, and the notification is displayed.

The error comes from startServiceWorker on the next visit after the notification was allowed. I changed the method (by removing the call of requestNotificationPermission()) to this and now it works fine:

async function startServiceWorker() {
  const vapidPublicKey = document.head
  await registerServiceWorker();

  const subscription = await getPushSubscription(vapidPublicKey);
  if (!subscription) return;

  await sendSubscriptionToServer(subscription);