Skip to content

Commit

Permalink
Fix the refetching flags (#1884)
Browse files Browse the repository at this point in the history
* fix(http-adapter): to refetch right away

* chore: changeset
  • Loading branch information
tdeekens authored Apr 4, 2024
1 parent 137f9e5 commit 1b89d9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-carpets-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@flopflip/http-adapter": patch
---

Fix http-adapter to reload flags right away
1 change: 1 addition & 0 deletions packages/http-adapter/src/adapter/adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ describe('when configured', () => {

beforeEach(async () => {
configurationResult = await adapter.reconfigure({
...adapterArgs,
user,
cacheIdentifier: 'session',
});
Expand Down
5 changes: 5 additions & 0 deletions packages/http-adapter/src/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ class HttpAdapter implements THttpAdapterInterface {
const nextUser = adapterArgs.user;

this.#adapterState.user = nextUser;

const flags = normalizeFlags(await this.#fetchFlags(adapterArgs));

this.#adapterState.flags = flags;

this.#subscribeToFlagsChanges(adapterArgs);

return Promise.resolve({
Expand Down

0 comments on commit 1b89d9a

Please sign in to comment.