Settings.getSettings() reads the setting values for a schema. Without a key, it resolves with all values; with a key, it resolves with that value only. Every value is null until it has been set.
It is available from both attio/client and attio/server:
Settings.useSettings this is not a hook, so it can be called outside React rendering, for example in an onTrigger handler or a server function. For React components, prefer Settings.useSettings, which provides real-time updates when settings change.
Parameters
WorkspaceSettingsSchema
required
The schema built with
Settings.defineWorkspaceSchema, imported
from your schema file.string
Optionally, the key of a single setting to retrieve. Must match a key defined in your schema;
the key is fully typed, so TypeScript will only allow valid setting keys.When omitted, all setting values are returned.
Returns
A promise resolving to all setting values (no key), or to the single requested value (with a key). Types are inferred from your schema; every value isnull until set.
Example
In a server function
src/sync-records.server.ts
In client code
src/app/extensions/sync-record/extension.tsx
Related
Settings.setSettings()- Write a setting valueSettings.useSettings()- Read settings reactively in React components