Skip to Content
Technical GuideData Ownership

State and data ownership

A URL, React context, browser storage and a backend record have different lifetimes. Identify the owner before changing a value or describing a reset. The provider hierarchy is in State Management; this page owns persistence and identity semantics.

Ownership register

ValueOwner / locationWriters and readersLifetime / reset
JWTCookie named by storage.tokenKeyutils/tokens; APIBase attaches it as BearerSet with a 30-day cookie expiry; actual validity uses JWT exp. Client logout removes it; server cookie deletion can be unavailable in a render
User profileUserProvider state + localStorage[profileKey]saveProfile, processAuthResponse, mount effectRestored after mount; removed on logout. A stored profile is not proof of a valid token
Logged-in UI stateUserProvider React stateMount effect, successful auth, logoutStarts false for hydration; becomes true after a valid cookie is found or auth succeeds
Search filtersRoute initialization + SearchProviderControls through provider actions; fetch/URL effects read themScoped provider lifetime; URL stores non-default values for a later visit
Drawn polygon / loaded regionSearchProviderDrawing or saved-search initializationclearPolygon clears both; drawing clears the loaded region
Selected external locationsFilter IDs + resolved map locationsURL parser admits configured resolvers; map resolver loads geometryListing fetch waits while selected IDs remain unresolved
Camera, style, layers and orientationMapOptionsProvider and map callbacksMap controls/movement; URL writerScoped map state; selected presentation values serialized for sharing
Listing results / clusters / statisticsSearchProvider saved responsesave maps API fields; grid/map read itReplaced by a successful response; a swallowed request error does not write an empty result
Open listing / multi-unit selectionSearchProvidersaveCachedListing, saveMultiUnits, clear actionsScoped UI cache, not a backend record
Favorite listingsBackend records + FavoritesProvider cacheAPIFavorites, add, remove, fetchHydrated for a logged-in user role; successful mutations change the cache
Favorite imagesBackend records + ImageFavoritesProvider cacheAPIImageFavoritesSimilar role-gated hydration; image identifiers are separate from favorite-listing IDs
Saved searchesBackend records + SaveSearchProvider cacheAPISavedSearch, provider create/update/deleteA saved search survives page navigation; current map state does not create one automatically
Autosuggest session tokenModule variable in utils/tokens.tsgetSessionToken generates a UUID on first useModule-instance lifetime; not the JWT and not a cookie
Recently viewedhooks/useRecents.ts and localStorage[recentsKey]Read/add/clear operations in the hookBrowser history collection; not a favorite backend record
Built-in NLP conversationChatContent state and nlpTokenKey / nlpHistoryKeySubmit, response, reset and hydrationPersists across reloads; result carousel snapshots belong to individual history items
Iframe conversationSupportAgent local state and generated session idNLP extraction and message handlersSeparate from built-in history; protocol reset-name mismatch is documented in F03
Estimate draftRHF values and EstimateProvider/hooks/useStorage.tsSave/read/reset of estimateDataKeyDraft persistence is not a submitted estimate; declared storage keys without consumers are not additional state
Estimate record/resultEstimateProvider data hooks plus backendCreate/update/fetch; ULID or numeric identitySuccessful result changes route state; failure retains/reopens form state
CMS content/metadataCmsService clients and resolverRemote content, local metadata override, rendererFetch/page cache policy; no browser provider owns the editorial record
Generated geography/countsLocationsTree static loader and process memoGenerator writes; routes/overlays readExplicit generation plus file/process lifecycle, separate from page ISR

Storage key literals come from src/configs/defaults/storage.ts and may be overridden. Do not assume every key declared there is an actively used persistence mechanism; locate its consumer first.

Identity conversions

IdentityConversion / useSource
ListingmlsNumber plus the applicable board context identifies the record being linked/fetchedutils/listings/seo.ts, listing route utilities; Listing Detail
FavoritefavoriteId returned by add is stored on the cached listing and used by removalFavoritesProvider.tsx
Saved searchsearchId selects a stored query; it is not a listing IDSaveSearchProvider, app/search/[layout]/page.tsx
Saved-search fieldsstyles → style, minBeds → minBedrooms, keywords → search; boundary values converted to the UI’s unset representationgetFiltersFromSavedSearch in search route _utils.ts
UI property/status choicelistingType / listingStatus transform into API fragments; type is sale/leaseservices/Search/adapter.ts, declarations.ts, types.ts
External overlay locationID resolves to geometry; the ID itself is not the MLS search constraintSearch parser, utils/map/externalLocations.ts, getSearchArea

A successful mutation changes two things

The provider updates its cache after the API resolves. In the inspected implementation, favorite add/fetch/remove catches errors silently and clears the relevant progress flag in finally. Do not document an optimistic rollback or an error toast that this code does not implement. Image favorites have their own response checks. Failure outcomes records the differences.

Authentication cleanup boundary

UserProvider.logout clears the client cookie, profile state and localStorage profile, removes a URL token, then reloads the page. Although APIAuth exposes a /auth/logout method, this provider’s logout implementation does not call it. Local sign-out therefore must not be described as demonstrated backend token revocation. APIBase also attempts token clearing on a 401; that alone does not synchronously update every provider’s React state.

Evidence and limits

Source-read against portal monorepo e30dd9b47, 2026-11-02: src/utils/tokens.ts, src/utils/xff.ts, src/configs/defaults/storage.ts, src/providers/{UserProvider,FavoritesProvider,ImageFavoritesProvider}.tsx, SearchProvider/SearchProvider.tsx, SaveSearchProvider/SaveSearchProvider.tsx, and search route _utils.ts. Mutation flows here are synthetic, not requests made against an account. Backend ownership enforcement and notification delivery are outside this frontend-only observation. Coverage.

Last updated on