Gets, sets and resets a project setting on the papi for a specified project. Also notifies subscribers when the project setting changes and gets updated when the project setting is changed by others.

When subscription callback function is called with an update that has an unexpected message type

  • Type Parameters

    Parameters

    • projectDataProviderSource: undefined | string | IBaseProjectDataProvider<any>

      projectDataProviderSource String name of the id of the project to get OR projectDataProvider (result of useProjectDataProvider if you want to consolidate and only get the Project Data Provider once). If you provide a project id, this hook will use a PDP for this project that supports the platform.base projectInterface.

      Note: If you provide a projectDataProvider directly, it must be an IBaseProjectDataProvider

    • key: ProjectSettingName

      The string id of the project setting to interact with

      WARNING: MUST BE STABLE - const or wrapped in useState, useMemo, etc. The reference must not be updated every render

    • defaultValue: ProjectSettingTypes[ProjectSettingName]

      The initial value to return while first awaiting the project setting value

    • OptionalsubscriberOptions: DataProviderSubscriberOptions

      Various options to adjust how the subscriber emits updates

      Note: this parameter is internally assigned to a ref, so changing it will not cause any hooks to re-run with its new value. This means that subscriberOptions will be passed to the data provider's subscribe<data_type> method as soon as possible and will not be updated again until dataProviderSource or selector changes.

    Returns [
        setting: ProjectSettingTypes[ProjectSettingName],
        setSetting: (newSetting: ProjectSettingTypes[ProjectSettingName]) => void,
        resetSetting: () => void,
        isLoading: boolean,
    ]

    [setting, setSetting, resetSetting]

    • setting: the current value for the project setting from the Project Data Provider with the specified key, either the defaultValue or the resolved setting value
    • setSetting: asynchronous function to request that the Project Data Provider update the project setting with the specified key. Returns true if successful. Note that this function does not update the data. The Project Data Provider sends out an update to this subscription if it successfully updates data.
    • resetSetting: asynchronous function to request that the Project Data Provider reset the project setting
    • isLoading: whether the setting value is awaiting retrieval from the Project Data Provider