@oxyhq/services 22.4.0 → 22.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ui/components/ProfileButton.js +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +2 -2
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +9 -0
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +28 -3
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +5 -5
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +1 -1
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +2 -2
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +9 -0
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +28 -3
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +5 -5
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +14 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +14 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ui/components/ProfileButton.tsx +1 -2
- package/src/ui/components/payment/PaymentDetailsStep.tsx +2 -2
- package/src/ui/hooks/queries/queryKeys.ts +17 -0
- package/src/ui/hooks/queries/useAccountQueries.ts +27 -3
- package/src/ui/screens/ConnectedAppsScreen.tsx +0 -1
- package/src/ui/screens/CreateAccountScreen.tsx +5 -5
|
@@ -145,7 +145,20 @@ function parseUpdatedAt(value: unknown): number | null {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* Get user by ID
|
|
148
|
+
* Get user by ID (identity-by-id).
|
|
149
|
+
*
|
|
150
|
+
* Keyed on the viewer-INDEPENDENT `queryKeys.users.detail(id)`: this hook is
|
|
151
|
+
* the card-identity workhorse (name, avatar, username, verified) and does NOT
|
|
152
|
+
* read the viewer-relative `relationship` field. Keeping the key
|
|
153
|
+
* viewer-independent lets external by-id identity seeders / precache layers
|
|
154
|
+
* (e.g. Mention's card enrichment) that all write `queryKeys.users.detail(id)`
|
|
155
|
+
* share a single cache entry — a viewer-scoped key would dead-end every seed
|
|
156
|
+
* and cause avatar/name flashes plus N+1 fetches.
|
|
157
|
+
*
|
|
158
|
+
* A viewer-scoped, relationship-aware by-id PROFILE fetch is intentionally NOT
|
|
159
|
+
* this hook — it would be a separate future `useUserProfileById` keyed on
|
|
160
|
+
* `queryKeys.users.detailForViewer(id, viewerId)`. No current consumer reads
|
|
161
|
+
* `relationship` from a by-id fetch (only the username path does).
|
|
149
162
|
*/
|
|
150
163
|
export const useUserById = (userId: string | null, options?: { enabled?: boolean }) => {
|
|
151
164
|
const { oxyServices } = useOxy();
|
|
@@ -168,10 +181,21 @@ export const useUserById = (userId: string | null, options?: { enabled?: boolean
|
|
|
168
181
|
* Get user profile by username
|
|
169
182
|
*/
|
|
170
183
|
export const useUserByUsername = (username: string | null, options?: { enabled?: boolean }) => {
|
|
171
|
-
const { oxyServices } = useOxy();
|
|
184
|
+
const { oxyServices, user } = useOxy();
|
|
185
|
+
// Viewer-scope the cache. Authenticated single-profile fetches embed a
|
|
186
|
+
// viewer-relative `relationship` ({ isFollowing, followsYou }); anonymous
|
|
187
|
+
// fetches omit it and different viewers get different values. Without the
|
|
188
|
+
// active viewer in the key, react-query freezes the first (often anonymous
|
|
189
|
+
// cold-boot) copy and never refetches when the session lands ~5-25s later,
|
|
190
|
+
// so the "Follows you" tag flashes then vanishes forever. Adding the viewer
|
|
191
|
+
// makes anon vs authed distinct entries AND forces a refetch when the
|
|
192
|
+
// session resolves or the account switches. (The SDK's GET response cache is
|
|
193
|
+
// already identity-scoped by the access-token user id via `computeIdentityTag`,
|
|
194
|
+
// so it never cross-poisons `relationship` — the only gap was this key.)
|
|
195
|
+
const viewerId = user?.id ?? '';
|
|
172
196
|
|
|
173
197
|
return useQuery({
|
|
174
|
-
queryKey:
|
|
198
|
+
queryKey: queryKeys.users.byUsername(username || '', viewerId),
|
|
175
199
|
queryFn: async () => {
|
|
176
200
|
if (!username) {
|
|
177
201
|
throw new Error('Username is required');
|
|
@@ -120,7 +120,6 @@ const ConnectedAppsScreen: React.FC<BaseScreenProps> = ({ onClose, goBack }) =>
|
|
|
120
120
|
t('connectedApps.item.granted', {
|
|
121
121
|
relative: formatRelative(item.firstGrantedAt),
|
|
122
122
|
})
|
|
123
|
-
|| `Granted ${formatRelative(item.firstGrantedAt)}`
|
|
124
123
|
}
|
|
125
124
|
onPress={isRevoking ? undefined : () => confirmRevoke(item)}
|
|
126
125
|
disabled={isRevoking}
|
|
@@ -79,13 +79,13 @@ const organizationCategoryLabel = (
|
|
|
79
79
|
): string => {
|
|
80
80
|
switch (category) {
|
|
81
81
|
case 'agency':
|
|
82
|
-
return t('accounts.organizationCategory.agency')
|
|
82
|
+
return t('accounts.organizationCategory.agency');
|
|
83
83
|
case 'cooperative':
|
|
84
|
-
return t('accounts.organizationCategory.cooperative')
|
|
84
|
+
return t('accounts.organizationCategory.cooperative');
|
|
85
85
|
case 'landlord':
|
|
86
|
-
return t('accounts.organizationCategory.landlord')
|
|
86
|
+
return t('accounts.organizationCategory.landlord');
|
|
87
87
|
default:
|
|
88
|
-
return t('accounts.organizationCategory.other')
|
|
88
|
+
return t('accounts.organizationCategory.other');
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
|
|
@@ -309,7 +309,7 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({
|
|
|
309
309
|
{kind === 'organization' ? (
|
|
310
310
|
<View className="gap-space-8">
|
|
311
311
|
<Text className="text-body font-bodyBold text-text">
|
|
312
|
-
{t('accounts.create.organizationCategory.label')
|
|
312
|
+
{t('accounts.create.organizationCategory.label')}
|
|
313
313
|
</Text>
|
|
314
314
|
<View className="flex-row flex-wrap gap-space-8">
|
|
315
315
|
{ORGANIZATION_CATEGORY_OPTIONS.map((option) => {
|