WindmillWWindmill
Powered by
EggingtonE
Windmill•7mo ago•
2 replies
Eggington

Saving to App State from File Input.

I am trying to create a CSV previewer in the windmill app editor (more steps later that is just step 1)... and I'm thinking my process should be that when a file is uploaded to the "file input" component, a background runnable will update state.csvContent to the decoded csv string, and then my preview text box watches state.csvContent and updates appropriately. The issue i'm encountering is that I can't seem to get state to update.

In my background runnable, I have passed state as an input.
export async function main(csv_file: string, state: any) {
  const decodedBytes = Uint8Array.from(atob(csv_file), c => c.charCodeAt(0));
  const decoder = new TextDecoder("utf-8");
  const csvContent = decoder.decode(decodedBytes);
  console.log(csvContent)
  state.csvContent = csvContent
  console.log(state)
}
export async function main(csv_file: string, state: any) {
  const decodedBytes = Uint8Array.from(atob(csv_file), c => c.charCodeAt(0));
  const decoder = new TextDecoder("utf-8");
  const csvContent = decoder.decode(decodedBytes);
  console.log(csvContent)
  state.csvContent = csvContent
  console.log(state)
}

here in the background runnable, when logging state it looks good, but in the editor sidebar, it never shows any new values populating to state... and likewise my text box is not rendering anything from state.csvContent
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

File input component & component re-rendering in app
DaanDDaan / help
15mo ago
Clearing file input
d10sfanDd10sfan / help
2y ago
Set Windmill App State From Bash Script
Trevor SullivanTTrevor Sullivan / help
3y ago
App Component File input stuck when file size is larger than 10MB.
Leon s kennedyLLeon s kennedy / help
11mo ago