hunk.code_window: 		self,
   		ctx: &LibraryContext,
   	) -> Result<indexer_job_location::Data, LocationError> {
   		// check if we have access to this location
   		if !self.path.exists() {
   			return Err(LocationError::PathNotFound(self.path));
   		}
  
hunk.labels: keep keep keep keep replace keep keep keep
hunk.after_edit: 		if !self.path.try_exists().unwrap() {
  
hunk.file_path: core/src/location/mod.rs
hunk.type: replace
file: import { useEffect } from 'react';
  import { useCountUp } from 'use-count-up';
  import { proxy, useSnapshot } from 'valtio';
  
  // const useCounterStore = create<{
  // 	counterLastValue: Map<string, number>;
  // 	setCounterLastValue: (key: string, value: number) => void;
  // }>((set) => ({
  // 	counterLastValue: new Map<string, number>(),
  // 	setCounterLastValue: (name, lastValue) =>
  // 		set((state) => ({
  // 			...state,
  // 			counterLastValue: state.counterLastValue.set(name, lastValue)
  // 		}))
  // }));
  
  const counterStore = proxy({
  	counterLastValue: new Map<string, number>(),
  	setCounterLastValue: (key: string, value: number) => {
  		counterStore.counterLastValue.set(key, value);
  	}
  });
  
  const useCounterState = (key: string) => {
  	const { counterLastValue, setCounterLastValue } = useSnapshot(counterStore);
  
  	return {
  		lastValue: counterLastValue.get(key),
  		setLastValue: setCounterLastValue
  	};
  };
  
  type UseCounterProps = {
  	name: string;
  	start?: number;
  	end: number;
  	/**
  	 * Duration of the counter animation in seconds
  	 * default: `2s`
  	 */
  	duration?: number;
  	/**
  	 * If `true`, counter will only count up/down once per app session.
  	 * default: `true`
  	 */
  	saveState?: boolean;
  };
  
  const useCounter = ({ name, start = 0, end, duration = 2, saveState = true }: UseCounterProps) => {
  	const { lastValue, setLastValue } = useCounterState(name);
  
  	if (saveState && lastValue) {
  		start = lastValue;
  	}
  
  	const { value } = useCountUp({
  		isCounting: !(start === end),
  		start,
  		end,
  		duration,
  		easing: 'easeOutCubic'
  	});
  
  	useEffect(() => {
  		if (saveState && Number(value) === end) {
  			setLastValue(name, end);
  		}
  		// eslint-disable-next-line react-hooks/exhaustive-deps
  	}, [end, value]);
  
  	if (start === end) return end;
  
  	if (saveState && lastValue && lastValue === end) return end;
  
  	return value;
  };
  
  export default useCounter;
  