Closed radist2s closed 2 months ago
Latest commit: e5a612ceb31b8a3c18ec3b7efbbb0df237bdaeb9
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Issue When the
<MoniteAPIProvider/>
is included within<MoniteScopedProviders/>
, a new instance ofQueryClient
is created each time, leading to the execution of an authorization request (/auth/token
). This occurs because<MoniteScopedProviders/>
directly wraps Super Components, which are unmounted and remounted whenever menu items change. As a result, multiple redundant/auth/token
requests are made, causing unnecessary API calls.Solution The
<MoniteAPIProvider/>
has been moved into the<MoniteContext/>
. By doing so, the sameQueryClient
instance is reused across the application, preventing the creation of new instances and thus avoiding redundant/auth/token
requests.Additionally, for the SDK Demo, the API provider now utilizes it's own
<QraftSecureRequestFn/>
provider, which generates asecuredRequestFn
. This replaces the previous approach of using the<MoniteAPIProvider/>
from the SDK React package, ensuring more tailored and secure request handling specific to the SDK Demo context.