Skip to content

Commit

Permalink
Chore: don't persist sample workflows to WNFS
Browse files Browse the repository at this point in the history
  • Loading branch information
avivash committed Nov 15, 2023
1 parent 9c9b0ae commit 06d4f3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/workflows/builder/function-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type GeneratorParams = {
type FunctionParams = { sigma: number } | { x: number; y: number; width: number; height: number } | Record<string, never>

export const DEFAULT_PARAMS: { [functionName: string]: FunctionParams } = {
blur: { sigma: 0.1 },
blur: { sigma: 20 },
crop: { x: 50, y: 50, width: 100, height: 100 },
grayscale: {},
rotate90: {}
Expand Down
5 changes: 4 additions & 1 deletion src/routes/workflows/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
// @ts-ignore-next-line
uint8arrays.toString(workflowsFromWNFS.content)
)
$workflowsStore.workflows = parsedWorkflows
$workflowsStore.workflows = [
...$workflowsStore.workflows,
...parsedWorkflows.filter(w => !w.id.includes('sampleWorkflow'))
]
}
$workflowsStore.loading = false
})
Expand Down
6 changes: 5 additions & 1 deletion src/routes/workflows/components/WorkflowBuilder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
// Save all workflows to the user's WNFS
const pushWorkflowsToWNFS = async () => {
const clonedWorkflows = JSON.parse(
JSON.stringify($workflowsStore.workflows)
)
await $filesystemStore.write(
odd.path.combine(WORKFLOWS_DIR, odd.path.file('workflows.json')),
new TextEncoder().encode(JSON.stringify($workflowsStore.workflows))
new TextEncoder().encode(JSON.stringify(clonedWorkflows.splice(3)))
)
await $filesystemStore.publish()
Expand Down

0 comments on commit 06d4f3b

Please sign in to comment.