diff --git a/public/index.html b/public/index.html index 8a5dac6..6677d9a 100644 --- a/public/index.html +++ b/public/index.html @@ -48,7 +48,6 @@ if ( !document.body.dataset.topic || document.body.dataset.topic !== topic_id ) { const previous = document.body.dataset.topic; - document.body.dataset.topic = topic_id; console.dir( { topic_changed: { @@ -95,7 +94,10 @@ if ( first_topic_id ) { window.location.hash = `/topic/${ first_topic_id }/chat`; } + return; } + + document.body.dataset.topic = topic_id; }); let TOPICS = []; @@ -117,9 +119,6 @@ try { const topics_response = await api.fetch("/api/topics"); if (topics_response.ok) { - const topic_list = document.getElementById("topic-list"); - topic_list.innerHTML = ""; - const new_topics = await topics_response.json(); const has_differences = TOPICS.length !== new_topics.length || new_topics.some( (topic, index) => { return ( TOPICS[ index ]?.id !== topic.id || TOPICS[ index ]?.name !== topic.name ); diff --git a/public/sidebar/sidebar.html b/public/sidebar/sidebar.html index 113fefc..fef3c33 100644 --- a/public/sidebar/sidebar.html +++ b/public/sidebar/sidebar.html @@ -5,10 +5,33 @@ for (const topic of topics) { topic_list.insertAdjacentHTML( "beforeend", - `