mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	perf: dont make db call if posts is already loaded client side
This commit is contained in:
		| @@ -183,7 +183,10 @@ define('navigator', [ | |||||||
| 	async function updateThumbTimestampToIndex(thumb, index) { | 	async function updateThumbTimestampToIndex(thumb, index) { | ||||||
| 		const el = thumb.find('.thumb-timestamp'); | 		const el = thumb.find('.thumb-timestamp'); | ||||||
| 		if (el.length) { | 		if (el.length) { | ||||||
| 			const timestamp = await getPostTimestampByIndex(index); | 			const postAtIndex = ajaxify.data.posts.find( | ||||||
|  | 				p => parseInt(p.index, 10) === Math.max(0, parseInt(index, 10) - 1) | ||||||
|  | 			); | ||||||
|  | 			const timestamp = postAtIndex ? postAtIndex.timestamp : await getPostTimestampByIndex(index); | ||||||
| 			el.attr('title', utils.toISOString(timestamp)).timeago(); | 			el.attr('title', utils.toISOString(timestamp)).timeago(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -450,7 +453,6 @@ define('navigator', [ | |||||||
| 		} | 		} | ||||||
| 		count = value; | 		count = value; | ||||||
| 		navigator.updateTextAndProgressBar(); | 		navigator.updateTextAndProgressBar(); | ||||||
| 		setThumbToIndex(index); |  | ||||||
| 		toggle(count > 0); | 		toggle(count > 0); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user