@@ -252,11 +252,18 @@ function parseURL() {
252252 const [ , user , repo , branch ] = pathMatch ;
253253 const fullRepo = `${ user } /${ repo } ` ; // Reconstruct repo format
254254
255- // Only fetch if data isn't already cached or relevant AND required elements exist
256- if ( currentRepo !== fullRepo || currentBranch !== branch || ! cachedTreeData ) {
257- if ( repoInput && branchInput ) {
258- repoInput . value = fullRepo ;
259- branchInput . value = branch ;
255+ // Store the current repo and branch values so we can update the UI
256+ // even if the page is directly loaded
257+ currentRepo = fullRepo ;
258+ currentBranch = branch ;
259+
260+ // Set input fields if they exist
261+ if ( repoInput && branchInput ) {
262+ repoInput . value = fullRepo ;
263+ branchInput . value = branch ;
264+
265+ // Only fetch if data isn't already cached
266+ if ( ! cachedTreeData ) {
260267 fetchRepoTree ( ) ; // This will handle metadata update after fetch
261268 }
262269 }
@@ -305,6 +312,10 @@ async function fetchRepoTree() {
305312 const [ username , repoName ] = repoInputVal . split ( '/' , 2 ) ;
306313 const repo = `${ username } /${ repoName } ` ; // Reconstruct for consistency, potentially cleaning input
307314
315+ // Store current values for state tracking
316+ currentRepo = repo ;
317+ currentBranch = branch ;
318+
308319 // Use SEO-friendly clean URL format immediately
309320 const branchSlug = branch . toLowerCase ( ) ;
310321 const cleanPath = `/repo/${ username } /${ repoName } /${ branchSlug } /` ;
0 commit comments