crkn-rcdr / sapindale

Sapper/Svelte access platform administration interface
2 stars 2 forks source link

components/Slug/Resolver enhancements #119

Closed RussellMcOrmond closed 3 years ago

RussellMcOrmond commented 3 years ago

We are using components/Slug/Resolver in routes/archivalmanifest.svelte

A few enhancements suggested.

RussellMcOrmond commented 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.

SaschaAdler commented 3 years ago

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.

RussellMcOrmond commented 3 years ago

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.

SaschaAdler commented 3 years ago

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".

SaschaAdler commented 3 years ago

Let me know if the changes I've merged from #122 work for you.

RussellMcOrmond commented 3 years ago

Seems to work great. Thank you.