diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index 9a6d9ea1d3..b31488e492 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -28,6 +28,10 @@ let inviting = false let searchFocus = false + //Or searching = true? + let filtered = true + $: console.log("filtering enabled ", filtered) + let appInvites = [] let filteredInvites = [] let filteredUsers = [] @@ -52,15 +56,31 @@ } const filterInvites = async query => { - appInvites = await getInvites() - if (!query || query == "") { - filteredInvites = appInvites + if (!prodAppId) { return } - filteredInvites = appInvites.filter(invite => invite.email.includes(query)) + + appInvites = await getInvites() + + //On Focus behaviour + if (!filtered && (!query || query == "")) { + filteredInvites = [...appInvites] + return + } + + filteredInvites = appInvites.filter(invite => { + const inviteInfo = invite.info?.apps + if ((!query || query == "") && inviteInfo && prodAppId) { + return Object.keys(inviteInfo).includes(prodAppId) + } + return invite.email.includes(query) + }) } - $: filterInvites(query) + $: filtered, prodAppId, filterInvites(query) + $: if (searchFocus === true) { + filtered = false + } const usersFetch = fetchData({ API, @@ -351,7 +371,7 @@ onMount(() => { rendered = true - searchFocus = true + // searchFocus = true }) function handleKeyDown(evt) { @@ -417,7 +437,6 @@ autocomplete="off" disabled={inviting} value={query} - autofocus on:input={e => { query = e.target.value.trim() }} @@ -428,16 +447,20 @@
@@ -481,6 +504,8 @@