Skip to content

Commit

Permalink
Merge pull request #1741 from evidence-dev/fix-features-a-regressions
Browse files Browse the repository at this point in the history
Fix `features/a` regressions
  • Loading branch information
archiewood authored Mar 15, 2024
2 parents 01c9f69 + 9a9ace8 commit 4910460
Show file tree
Hide file tree
Showing 15 changed files with 263 additions and 218 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-hornets-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Adjusts multi-dropdowns to return ARRAY rather than LIST types
6 changes: 6 additions & 0 deletions .changeset/gorgeous-eels-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/core-components': patch
'@evidence-dev/query-store': patch
---

fix features/a regressions involving initialData and Dropdowns
6 changes: 6 additions & 0 deletions .changeset/twenty-jars-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/core-components': patch
'@evidence-dev/evidence': patch
---

Maxwidth option to layout, bug fixes
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import { browser } from '$app/environment';
import debounce from 'lodash.debounce';
import { QueryStore } from '@evidence-dev/query-store';
import formatTitle from '@evidence-dev/component-utilities/formatTitle';
const inputs = getContext(INPUTS_CONTEXT_KEY);
Expand Down Expand Up @@ -66,15 +67,18 @@
if (typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean')
return String(value);
if (value instanceof Date) return `'${value.toISOString()}'::TIMESTAMP_MS`;
if (Array.isArray(value)) return `[${value.map((x) => jsToDuckDB(x)).join(',')}]`;
if (Array.isArray(value)) return `[${value.map((x) => jsToDuckDB(x)).join(', ')}]`;
return JSON.stringify(value);
}
function selectedValuesToInput() {
let values;
if (multiple) {
values = $selectedValues.map((x) => x.value);
values.toString = () => jsToDuckDB(values);
values.toString = () =>
values.length === 0
? `(select null where 0)`
: `(${values.map((x) => jsToDuckDB(x)).join(', ')})`;
} else {
values = $selectedValues[0]?.value ?? null;
// the default `toString` method for Dates aren't good for duckdb
Expand Down Expand Up @@ -170,7 +174,7 @@
$: debouncedUpdateItems(search);
</script>
{#key query}
{#key $items}
<Invisible>
<slot />
Expand Down Expand Up @@ -212,7 +216,7 @@
{:else if $selectedValues.length > 0 && !multiple}
{$selectedValues[0].label}
{:else}
{title}
{title ?? formatTitle(name)}
{/if}
<!-- {$selectedValues.length > 0 && !multiple ? $selectedValues[0].label : title} -->
<Icon src={CaretSort} class="ml-2 h-4 w-4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
export let xProfile;
/** @type {string} */
export let slackCommunity;
/** @type {string}*/
export let maxWidth = undefined;
const prefetchStrategy = dev ? 'tap' : 'hover';
Expand All @@ -56,14 +58,17 @@
{logo}
{neverShowQueries}
{fullWidth}
{maxWidth}
{hideSidebar}
{githubRepo}
{slackCommunity}
{xProfile}
{algolia}
/>
<div
class={(fullWidth ? 'max-w-full ' : 'max-w-7xl ') +
class={(fullWidth ? 'max-w-full ' : maxWidth ? '' : ' max-w-7xl ') +
'print:w-[650px] mx-auto print:md:px-0 print:px-0 px-6 sm:px-8 md:px-12 flex justify-start'}
style="max-width:{maxWidth}px;"
>
{#if !hideSidebar}
<div class="print:hidden">
Expand Down
3 changes: 3 additions & 0 deletions packages/core-components/src/lib/organisms/layout/Logo.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script>
import defaultLogo from './wordmark-gray-800.png';
export let logo;
export let title;
</script>

{#if logo}
<img src={logo} alt="logo" class="h-5 aspect-auto" href="/" />
{:else if title}
{title}
{:else}
<img src={defaultLogo} alt="evidence" class="h-5 aspect-auto" href="/" />
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
export let logo;
export let neverShowQueries;
export let fullWidth;
export let maxWidth;
export let hideSidebar;
export let algolia;
Expand All @@ -25,32 +27,34 @@
class="fixed w-full top-0 z-40 flex h-12 shrink-0 justify-start items-center gap-x-4 border-b border-gray-200 bg-white/90 backdrop-blur print:hidden"
>
<div
class={(fullWidth ? 'max-w-full ' : 'max-w-7xl ') +
'mx-auto px-6 sm:px-8 md:px-12 flex flex-1 justify-self-start justify-between items-center'}
class={(fullWidth ? 'max-w-full ' : maxWidth ? '' : ' max-w-7xl ') +
'mx-auto px-6 sm:px-8 md:px-12 flex flex-1 items-center justify-between'}
style="max-width:{maxWidth}px;"
>
<a href="/" class="hidden md:block text-sm font-bold text-gray-800">
{#if title}
{title}
{:else}
<Logo {logo} />
{/if}
</a>

<button
type="button"
class="text-gray-900 hover:bg-gray-50 rounded-lg p-1 md:hidden transition-all duration-500"
on:click={() => {
mobileSidebarOpen = !mobileSidebarOpen;
}}
>
{#if mobileSidebarOpen}
<span class="sr-only">Close sidebar</span>
<Icon class="w-5 h-5" src={X} />
{:else}
<span class="sr-only">Open sidebar</span>
<Icon class="w-5 h-5" src={Menu2} />
{/if}
</button>
{#if hideSidebar}
<a href="/" class="block text-sm font-bold text-gray-800">
<Logo {logo} {title} />
</a>
{:else}
<a href="/" class="hidden md:block text-sm font-bold text-gray-800">
<Logo {logo} {title} />
</a>
<button
type="button"
class="text-gray-900 hover:bg-gray-50 rounded-lg p-1 md:hidden transition-all duration-500"
on:click={() => {
mobileSidebarOpen = !mobileSidebarOpen;
}}
>
{#if mobileSidebarOpen}
<span class="sr-only">Close sidebar</span>
<Icon class="w-5 h-5" src={X} />
{:else}
<span class="sr-only">Open sidebar</span>
<Icon class="w-5 h-5" src={Menu2} />
{/if}
</button>
{/if}
<div class="flex gap-2 text-sm items-center pr-6">
{#if algolia}
<AlgoliaDocSearch {algolia} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@
<div class=" pb-4 text-gray-700">
<div class="py-3 px-8 mb-3 flex items-start justify-between">
<a href="/" class="block mt-1 text-sm font-bold text-gray-800">
{#if title}
{title}
{:else}
<Logo {logo} />
{/if}
<Logo {logo} {title} />
</a>
<span
on:click={() => (mobileSidebarOpen = false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@
</p>
{:else}
<Accordion>
<AccordionItem small>
<div slot="title" class="w-full flex justify-between items-center">
All Environment Variables
<AccordionItem title="All Environment Variables">
<div class="w-full flex justify-end items-center my-1 mb-2">
<Button on:click={copyVars} type="button" outline icon={Clipboard} size="sm">
Copy All
</Button>
</div>

<div class="titles">
<span class="title">Key</span><span class="title">Value</span>
</div>
{#each datasourceSettings as datasource}
{#each Object.entries(datasource.environmentVariables) as [key, value]}
<div class="environment-variable">
<div class="var-name">
<VariableCopy small text={key} />
<VariableCopy text={key} />
</div>
<div class="var-value">
<VariableCopy small text={value} hideText={true} />
<VariableCopy text={value} hideText={true} />
</div>
</div>
{/each}
Expand Down
2 changes: 1 addition & 1 deletion packages/query-store/src/QueryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class QueryStore extends AbstractStore<QueryStoreValue> {
}
);

if (opts.noResolve) {
if (opts.noResolve && !opts.initialData) {
this.#dataLoading = true;
this.#metaLoading = true;
this.#lengthLoading = true;
Expand Down
Loading

0 comments on commit 4910460

Please sign in to comment.