Skip to content

Commit 5bf41d0

Browse files
prioritize URIs in query string
1 parent bc303ae commit 5bf41d0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

todo.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,22 @@ class TodoApp extends Component {
174174
/* -------------------- STORAGE PROVIDER CONFIGURATION -------------------- */
175175
// Get configured storage provider with enhanced DID-based discovery
176176
getStorageProvider () {
177-
// First check if we have URIs from TypeRegistrations or query params
178-
let availableUris = [...this.state.availableUris]
179-
180-
// If no TypeRegistration URIs, check query string
181-
if (availableUris.length === 0) {
182-
const queryUris = this.parseUrisFromQueryString()
177+
// First check query string (takes priority over TypeRegistrations)
178+
const queryUris = this.parseUrisFromQueryString()
179+
let availableUris = []
180+
181+
if (queryUris.length > 0) {
182+
// Query string URIs take priority
183183
availableUris = queryUris
184-
184+
185185
// Store the available URIs in state for later use
186-
if (queryUris.length > 0 && this.state.availableUris.length === 0) {
186+
if (this.state.availableUris.length === 0 ||
187+
JSON.stringify(this.state.availableUris) !== JSON.stringify(queryUris)) {
187188
this.setState({ availableUris: queryUris })
188189
}
190+
} else {
191+
// Fall back to TypeRegistrations if no query URIs
192+
availableUris = [...this.state.availableUris]
189193
}
190194

191195
// Get the current URI (either the selected one or the first one)

0 commit comments

Comments
 (0)