Skip to content

Commit d9c6592

Browse files
committed
Fix
1 parent 91e5016 commit d9c6592

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

scripts/sync-sched/speakers.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@
88
"avatar": "//avatars.sched.co/b/99/18743846/avatar.jpg.320x320px.jpg?b57",
99
"role": "speaker",
1010
"tags": "",
11-
"tickets": [],
12-
"plusones": 0,
13-
"~syncedDetailsAt": 1749489924661
11+
"~syncedDetailsAt": 1749491538699,
12+
"company": "Graphile",
13+
"position": "GraphQL Community Gardener",
14+
"location": "Chandler's Ford, UK",
15+
"socialurls": []
1416
},
1517
{
1618
"username": "lee_byron.25jvpjmb",
1719
"name": "Lee Byron",
1820
"email": "[email protected]",
1921
"about": "",
2022
"url": "",
21-
"avatar": "http://avatars.sched.co/5/24/18743534/avatar.jpg.320x320px.jpg?480",
23+
"avatar": "//avatars.sched.co/5/24/18743534/avatar.jpg.320x320px.jpg?480",
2224
"role": "speaker",
2325
"tags": "",
24-
"tickets": [],
25-
"plusones": 0,
26+
"~syncedDetailsAt": 1749491538699,
2627
"company": "GraphQL Foundation",
2728
"position": "Co-creator of GraphQL and Director",
2829
"location": "",
2930
"socialurls": []
3031
},
3132
{
3233
"username": "saihaj",
34+
"company": "",
35+
"position": "",
3336
"name": "Saihajpreet Singh",
34-
"email": "[email protected]",
3537
"about": "",
38+
"location": "",
3639
"url": "",
3740
"avatar": "",
3841
"role": "speaker",
39-
"tags": "",
40-
"tickets": [],
41-
"plusones": 0,
42-
"~syncedDetailsAt": 1749489924661
42+
"socialurls": []
4343
}
4444
]

scripts/sync-sched/sync.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ async function updateSpeakerDetails(
172172
if (location) {
173173
const [key, index] = location
174174
if (key === "changed") {
175-
comparison[key][index].new = speaker
175+
comparison[key][index].new = {
176+
...comparison[key][index].new,
177+
...speaker,
178+
}
176179
comparison[key][index].new["~syncedDetailsAt"] = Date.now()
177180
} else {
178181
comparison[key][index] = speaker
@@ -309,15 +312,7 @@ function yellow(text: string) {
309312
}
310313

311314
function deepStrictEqualWithoutInternals(a: unknown, b: unknown): boolean {
312-
if (a === b) return true
313-
314-
if (a === null || b === null || a === undefined || b === undefined) {
315-
return a === b
316-
}
317-
318-
if (typeof a !== typeof b) return false
319-
320-
if (typeof a !== "object") return false
315+
if (typeof a !== "object") return a === b
321316

322317
if (Array.isArray(a) !== Array.isArray(b)) return false
323318

@@ -343,10 +338,6 @@ function deepStrictEqualWithoutInternals(a: unknown, b: unknown): boolean {
343338
aKeys.sort()
344339
bKeys.sort()
345340

346-
for (let i = 0; i < aKeys.length; i++) {
347-
if (aKeys[i] !== bKeys[i]) return false
348-
}
349-
350341
for (const key of aKeys) {
351342
if (!deepStrictEqualWithoutInternals(aObj[key], bObj[key])) {
352343
return false

src/app/conf/_api/sched-client.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ export async function getSchedule(
125125
const SPEAKER_FIELDS =
126126
"username,company,position,name,about,location,url,avatar,role,socialurls"
127127

128+
// We receive this fields despite the fact we don't ask for them.
129+
const SPEAKER_IGNORED_FIELDS = ["plusones", "tickets"]
130+
128131
export async function getSpeakers(
129132
ctx: RequestContext,
130133
): Promise<SchedSpeaker[]> {
@@ -135,11 +138,17 @@ export async function getSpeakers(
135138
const result = users
136139
.filter(speaker => speaker.role.includes("speaker"))
137140
.map(user => {
138-
return {
141+
const res = {
139142
...user,
140143
socialurls: user.socialurls || [],
141144
about: preprocessDescription(user.about),
142145
}
146+
147+
for (const field of SPEAKER_IGNORED_FIELDS) {
148+
delete res[field as keyof typeof res]
149+
}
150+
151+
return res
143152
})
144153
.sort((a, b) => {
145154
if (a.avatar && !b.avatar) return -1
@@ -162,6 +171,10 @@ export async function getSpeakerDetails(
162171
term: username,
163172
})
164173

174+
for (const field of SPEAKER_IGNORED_FIELDS) {
175+
delete data[field as keyof typeof data]
176+
}
177+
165178
return data as SchedSpeaker
166179
}
167180

0 commit comments

Comments
 (0)