tangled
alpha
login
or
join now
byarielm.fyi
/
atlast
16
fork
atom
ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto
16
fork
atom
overview
issues
1
pulls
pipelines
fix new platform not saving
byarielm.fyi
4 months ago
a62ab972
4e0efdf7
+7
-5
1 changed file
expand all
collapse all
unified
split
src
App.tsx
+7
-5
src/App.tsx
···
24
24
25
25
// Add state to track current platform
26
26
const [currentPlatform, setCurrentPlatform] = useState<string>('tiktok');
27
27
-
const saveCalledRef = useRef(false);
27
27
+
const saveCalledRef = useRef<string | null>(null); // Track by uploadId
28
28
29
29
// Search hook
30
30
const {
···
62
62
63
63
setSearchResults(resultsWithPlatform);
64
64
setCurrentStep('loading');
65
65
+
66
66
+
const uploadId = crypto.randomUUID();
67
67
+
65
68
searchAllUsers(
66
69
resultsWithPlatform,
67
70
setStatusMessage,
68
71
() => {
69
72
setCurrentStep('results');
70
73
// Prevent duplicate saves
71
71
-
if (!saveCalledRef.current) {
72
72
-
saveCalledRef.current = true;
74
74
+
if (saveCalledRef.current !== uploadId) {
75
75
+
saveCalledRef.current = uploadId;
73
76
// Need to wait for React to finish updating searchResults state
74
77
// Use a longer delay and access via setSearchResults callback to get final state
75
78
setTimeout(() => {
76
79
setSearchResults(currentResults => {
77
80
if (currentResults.length > 0) {
78
78
-
const uploadId = crypto.randomUUID();
79
81
apiClient.saveResults(uploadId, platform, currentResults).catch(err => {
80
82
console.error('Background save failed:', err);
81
83
});
···
108
110
109
111
const platform = 'tiktok'; // Default, will be updated when we add platform to upload details
110
112
setCurrentPlatform(platform);
111
111
-
saveCalledRef.current = false;
113
113
+
saveCalledRef.current = null;
112
114
113
115
// Convert the loaded results to SearchResult format with selectedMatches
114
116
const loadedResults = data.results.map(result => ({