Skip to content

fix(profile): invalidateProfileQueries matches no queries — 9 of 11 keys are misnamespaced #581

Closed

Description

@thinkclay

invalidateProfileQueries is called after every profile save (general, certifications, skills, experience, employment). Nine of its eleven query keys match nothing, because the helper namespaces keys under 'scaffald' while the hooks that register them do not.

Evidence

packages/scf-core/features/profile/utils/profile-sync.ts:6 invalidates:

helper key actual registered key matches?
['scaffald','profiles','general'] ['profiles','general'] (profile-general-sdk-hooks.ts:58) no
['scaffald','profiles','employment'] ['profiles','employment'] (:34) no
['scaffald','profiles','education'] ['profiles','education'] (:35) no
['scaffald','profiles','education-level'] ['profiles','education','level'] (:55) no
['scaffald','profiles','experience'] ['profiles','experience'] (:35) no
['scaffald','profiles','experience-summary'] ['profiles','experience','summary'] (:55) no
['scaffald','profiles','certifications'] ['profiles','certifications'] (:211) no
['scaffald','profiles','certifications','top-level'] ['profiles','certifications','top-level',params] no
['scaffald','user-profiles'] ['user-profiles',…] (user-profiles-sdk-hooks.ts:21) no
['scaffald','skills','multi-taxonomy'] same (:240) yes
['scaffald','skills','legacy'] same (:330) — but that endpoint 404s (#583) yes/moot

The widget queries the Profile Overview actually renders — ['profiles','widgets','general'|'experience'|'education'|'skills',userId] (profile-widgets-sdk-hooks.ts:67) — are not in the list at all, under either spelling.

Why the test did not catch it

packages/scf-core/features/profile/utils/tests/profile-sync.test.ts:12 asserts toHaveBeenCalledTimes(11) against a bare mock. It can never fail on a wrong key.

Impact

Save a profile section, then navigate to Profile Overview: the widgets still show pre-save data until the 2–5 minute staleTime lapses.

Acceptance

  • Query keys come from one shared factory used by both the hooks and the invalidator, so the two cannot drift.
  • Widget query keys are invalidated on save.
  • The test registers real queries in a real QueryClient and asserts they become stale — not that a mock was called N times.

Activity

  1. added
    bug
    agent-ready
    on Aug 12, 2026
  2. thinkclay commented on Aug 12, 2026

    @thinkclay
    ContributorAuthor

    Part of the profile-building audit rollup: #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Frontendagent-readybugpriority: hightype: frontend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions