File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,15 +18,7 @@ function Learn() {
1818 const updateTimeoutRef = useRef < number | null > ( null ) ;
1919
2020 // Extract json ID from hash
21- const getJsonIdFromHash = ( ) => {
22- const hash = location . hash ;
23- if ( hash . startsWith ( '#json=' ) ) {
24- return hash . replace ( '#json=' , '' ) ;
25- }
26- return null ;
27- } ;
28-
29- const jsonId = getJsonIdFromHash ( ) ;
21+ const jsonId = location . hash . startsWith ( '#json=' ) ? location . hash . replace ( '#json=' , '' ) : null ;
3022
3123 // Load roadmap data from jsonStore if needed
3224 useEffect ( ( ) => {
@@ -141,6 +133,13 @@ function Learn() {
141133 }
142134 } , [ ] ) ;
143135
136+ // Load all maps for the list view
137+ useEffect ( ( ) => {
138+ if ( ! jsonId ) {
139+ db . getAllLearningMaps ( ) . then ( setAllMaps ) ;
140+ }
141+ } , [ jsonId ] ) ;
142+
144143 const handleAddMap = ( ) => {
145144 // Parse URL to extract json ID
146145 const urlMatch = newMapUrl . match ( / # j s o n = ( [ ^ & ] + ) / ) ;
@@ -268,13 +267,6 @@ function Learn() {
268267 ) ;
269268 }
270269
271- // Load all maps for the list view
272- useEffect ( ( ) => {
273- if ( ! jsonId ) {
274- db . getAllLearningMaps ( ) . then ( setAllMaps ) ;
275- }
276- } , [ jsonId ] ) ;
277-
278270 return (
279271 < div className = "learn-list-container" >
280272 < div className = "learn-toolbar" >
You can’t perform that action at this time.
0 commit comments