Closed RussellMcOrmond closed 3 years ago
The bind:available seems to always be true, so doesn't seem to be doing what I'd expect. Likely because if the string passed in is available then it's not quite what you want.
Alright, I've reworked components/Slug/Resolver.svelte
. I've also changed the name of the properties it takes to be more clear. If you provide it both slug
and noid
, it will not try to resolve the slug
on mount. In fact, it won't ever, and so noid
had better be correct!
I have examples set up that you can take a look at. Don't worry about hideInitial
, as it's mostly helpful for editor contexts.
Is it possible to set 'noid' to something that means "I looked this up already , and know it doesn't exist".
When noid is set to a noid there is no further lookup, but when noid is set to null
(wasn't found) it then does the lookup again.
In https://github.com/crkn-rcdr/sapindale/blob/bulkslug/src/routes/slug/many.json.js I am using false
to indicate the slug doesn't exist, which is separate from null
which would indicate that it wasn't looked up at all yet.
Good point. I'll sort that out discerning between noid === null
as "I didn't find anything" and noid === undefined
as "I need to look it up".
Let me know if the changes I've merged from #122 work for you.
Seems to work great. Thank you.
We are using components/Slug/Resolver in routes/archivalmanifest.svelte
A few enhancements suggested.
slug = { id: value, type: "none" };
isn't correct as the id: is intended to be a noid. But I only made sufficient changes to get the component working to test routes/archivalmanifest.svelte . There will be better ways to handle this functionality.access
database does not return a value, so the type (manifest or collection) is not available. My suggestion is to move away from/{slug.type}/{slug.id}
to using a generic ID resolver (one for slugs, one for noids) that then directs to the correct editor.