We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e566c4a commit 7baa4a1Copy full SHA for 7baa4a1
lib/src/store.ts
@@ -144,12 +144,22 @@ export class Store {
144
145
/** Checks if a subject is free to use */
146
public async checkSubjectTaken(subject: string): Promise<boolean> {
147
- const r = await this.getResourceAsync(subject);
+ const r = this.resources.get(subject);
148
149
- if (r.isReady()) {
+ if (r?.isReady() && !r.new) {
150
return true;
151
}
152
153
+ try {
154
+ const resp = await this.fetchResourceFromServer(subject);
155
+
156
+ if (resp.isReady()) {
157
+ return true;
158
+ }
159
+ } catch (e) {
160
+ // If the resource doesn't exist, we can use it
161
162
163
return false;
164
165
0 commit comments