Skip to content

getSharedState() will not return the latest if the given event is nil #563

@yangyansong-adbe

Description

@yangyansong-adbe

Expected Behaviour

    /// Retrieves the `SharedState` for a specific extension
    /// - Parameters:
    ///   - extensionName: An extension name whose `SharedState` will be returned
    ///   - event: If not nil, will retrieve the `SharedState` that corresponds with this event's version. If nil will return the latest `SharedState`
    ///   - barrier: If true, the `EventHub` will only return `.set` if `extensionName` has moved past `event`
    ///   - sharedStateType: The type of shared state to be read from, if not provided defaults to `.standard`
    /// - Returns: The `SharedState` data and status for the extension with `extensionName`

From the above public API doc, getSharedState() should return the latest SharedState if the given even is nil.

Actual Behaviour

let result = sharedState.resolve(version: version)

SharedState.resolve() will return the oldest one if the event version is 0.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Metadata

Metadata

Labels

bugSomething isn't working. Used by issue templatescoresquad

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions