1 Commits
Author SHA1 Message Date
bachirandClaude Opus 5.5 54e7e28046 materiotheme: tab title from the search, safe terms of old URLs (F3)
- Base.vue: the browser tab shows the phrase searched (vue-meta), « Base »
  without a search.
- terms of an old or edited URL parsed without throwing: malformed JSON
  is ignored.
- Production build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ShDspHaZGwHoRZCsPBJzsM
2026-11-17 21:14:09 +01:00
13 changed files with 26 additions and 9 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -51,7 +51,8 @@ export default {
count: state => state.Search.count, count: state => state.Search.count,
noresults: state => state.Search.noresults, noresults: state => state.Search.noresults,
limit: state => state.Search.limit, limit: state => state.Search.limit,
searchId: state => state.Search.searchId searchId: state => state.Search.searchId,
keys: state => state.Search.keys
}), }),
// items is a sparse array (pages placed by offset); drop the holes left by // items is a sparse array (pages placed by offset); drop the holes left by
// pages that returned fewer results than the limit before rendering. // pages that returned fewer results than the limit before rendering.
@@ -59,7 +60,23 @@ export default {
return this.items.filter(Boolean) return this.items.filter(Boolean)
} }
}, },
// Title of the browser tab: the phrase searched (F3).
metaInfo () {
return {
title: this.keys && this.keys.length ? this.keys.join(', ') : 'Base'
}
},
methods: { methods: {
// terms of an URL: a JSON list, possibly malformed in an old or edited
// link; never break the page for it (F3).
parseTerms (value) {
try {
const terms = JSON.parse(value)
return Array.isArray(terms) ? terms : []
} catch (e) {
return []
}
},
...mapActions({ ...mapActions({
newSearch: 'Search/newSearch', newSearch: 'Search/newSearch',
nextPage: 'Search/nextPage' nextPage: 'Search/nextPage'
@@ -87,7 +104,7 @@ export default {
if (params.has('terms')) { if (params.has('terms')) {
console.log('Base created, has terms', params.get('terms')) console.log('Base created, has terms', params.get('terms'))
// this.$store.commit('Search/setTerms', params.get('terms').split(',')) // this.$store.commit('Search/setTerms', params.get('terms').split(','))
this.$store.commit('Search/setTerms', JSON.parse(params.get('terms'))) this.$store.commit('Search/setTerms', this.parseTerms(params.get('terms')))
} else { } else {
this.$store.commit('Search/reSetTerms') this.$store.commit('Search/reSetTerms')
} }
@@ -105,7 +122,7 @@ export default {
// to.query.terms is a raw JSON string (see SearchForm.submit) and must be // to.query.terms is a raw JSON string (see SearchForm.submit) and must be
// parsed like in created(), otherwise getResults() double-encodes it and // parsed like in created(), otherwise getResults() double-encodes it and
// the backend silently drops the terms (less relevant results). // the backend silently drops the terms (less relevant results).
this.$store.commit('Search/setTerms', JSON.parse(to.query.terms)) this.$store.commit('Search/setTerms', this.parseTerms(to.query.terms))
}else{ }else{
this.$store.commit('Search/reSetTerms') this.$store.commit('Search/reSetTerms')
} }