Skip to content

Commit

Permalink
Format-changes and avoid writing out the hash
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed Dec 14, 2023
1 parent 9f52a2a commit e53188d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/duckdb-wasm-shell/src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ShellRuntime {
database: duckdb.AsyncDuckDB | null;
history: HistoryStore;
resizeHandler: (_event: UIEvent) => void;
hash: string;

constructor(protected container: HTMLDivElement) {
this.database = null;
Expand All @@ -28,6 +29,7 @@ class ShellRuntime {
const rect = container.getBoundingClientRect();
shell.resize(rect.width, rect.height);
};
this.hash = "";
}

public async pickFiles(this: ShellRuntime): Promise<number> {
Expand All @@ -51,7 +53,6 @@ class ShellRuntime {
return await navigator.clipboard.writeText(value);
}
public async pushInputToHistory(this: ShellRuntime, value: string) {
var hash = window.location.hash;
const encode = encodeURIComponent(extraswaps(value));
if (hash === "")
hash = "queries=v0";
Expand Down Expand Up @@ -142,10 +143,10 @@ export async function embed(props: ShellProps) {
await step('Attaching Shell', async () => {
shell.configureDatabase(runtime.database);
});
var hash = window.location.hash;
var splits = hash.split(',');
var sqls : Array<string> = [];
for (var i=1; i< splits.length; i++) {
let hash = window.location.hash;
let splits = hash.split(',');
let sqls : Array<string> = [];
for (let i=1; i< splits.length; i++) {
sqls.push(extraswaps(decodeURIComponent(splits[i])));
}
window.location.hash="";
Expand Down

0 comments on commit e53188d

Please sign in to comment.