import { useSessionQueryName } from '../stores/editor-store';

/**
 * This component isolates the work of updating the document title on query name changes.
 * This is a component to prevent the main QueryEditor component from rendering on name change.
 * @param {object} props
 */
function DocumentTitle({ queryId }: { queryId: string }) {
  const queryName = useSessionQueryName();
  const title = queryId === '' ? 'New query' : queryName;

  if (document.title !== title) {
    console.log('updating title');
    document.title = title;
  }

  return null;
}

export default DocumentTitle;

import { useEffect } from 'react';
import { useSessionQueryName } from '../stores/editor-store';

/**
 * This component isolates the work of updating the document title on query name changes.
 * This is a component to prevent the main QueryEditor component from rendering on name change.
 * @param {object} props
 */
function DocumentTitle({ queryId }: { queryId: string }) {
  const queryName = useSessionQueryName();
  const title = queryId === '' ? 'New query' : queryName;

  useEffect(() => {
    document.title = title;
  }, [title]);

  return null;
}

export default DocumentTitle;

--- 
+++ 
@@ -1,4 +1,3 @@
-import { useEffect } from 'react';
 import { useSessionQueryName } from '../stores/editor-store';
 
 /**
@@ -10,9 +9,10 @@
   const queryName = useSessionQueryName();
   const title = queryId === '' ? 'New query' : queryName;
 
-  useEffect(() => {
+  if (document.title !== title) {
+    console.log('updating title');
     document.title = title;
-  }, [title]);
+  }
 
   return null;
 }
Fix document title not changing on sign in
