the-via / releases

GNU General Public License v3.0
2.05k stars 222 forks source link

Clicking on the "save" button in "SAVE + LOAD" won't do anything #241

Open GrafDogi opened 1 year ago

GrafDogi commented 1 year ago

I use the installed version on Windows 10. I changed a few keystrokes and wanted to save them in case something goes wrong.

Expected behaviour: I click on "Save", a dialogue opens where I can choose the folder where to save the JSON(?) file.

Actual behavior: Nothing happens after clicking on "Save".

copycut commented 1 year ago

I'm using mac os (10.15) and have the same issue.

GrafDogi commented 1 year ago

Found out, you need to visit https://www.keychron.com/blogs/archived/how-to-use-via-to-program-your-keyboard, click on "link" at "Or you can go to this link to find the JSON file for your keyboard.", load the correct JSON file and follow the instructions in the short video from the page before, below the "link".

Worked like a charm for me.

madotha commented 1 year ago

I can confirm it works if you previously load the JSON for the layout. Still, I think this to be a bug and would expect to work, as the layout is already saved in VIA itself and we should be able to save our customizations without having to first load a static layout.

wilba commented 1 year ago

The Save/Load buttons here:

image

are for saving/loading a layout, i.e. the keycodes bound to each key.

AFAIK this is working for the webapp https://usevia.app and the downloadable 2.1.0 client.

I do not understand this "workaround"... these are instructions for Keychron keyboards only, and describe how to load a keyboard definition JSON file so that VIA can detect the keyboard, and this process is a non-standard, unofficial way of using VIA.

ValdisThomann commented 1 year ago

Closing as can't reproduce issue.

GrafDogi commented 1 year ago

Erm... Just bc YOU can't reproduce that bug, doesn't mean there is no bug since there seem to be many other who have that issue, though!!

madotha commented 1 year ago

I totally agree with @GrafDogi; can we at least provide further information (keyboard, OS, etc.)? Or maybe it even has to do with the built-in keyboard layouts in VIA.

ValdisThomann commented 1 year ago

@GrafDogi @madotha happy to re-open if you'd like to provide more detailed repro steps.

I couldn't reproduce on Windows 11 using https://usevia.app/ or https://github.com/the-via/releases/releases/latest using a HS60 V2 with latest firmware.

It would be good if you could provide more detail about your workaround. I may have misinterpreted your update as confusion about the definition json vs the save/load layout json.

GrafDogi commented 1 year ago

I am happy to help.

As I mentioned earlier, "I use the installed version on Windows 10". I am using a Keychron Q3.

But as I also mentioned in my 2nd comment, you still have to visit that said link, download the appropriate JSON file for your keyboard and drag it in the "design" tab in VIA. Only THEN I was able to see the "save as" dialogue.

But(!) I have to repeat that step as the save button won't work / the "save as" dialoge won't show AFTER restarting VIA.

GreatWizard commented 1 year ago

I confirm the bug on Ubuntu with all native 2.x releases... I got the following log when clicking on save

[34843:0307/150555.309898:ERROR:select_file_dialog_linux_portal.cc(716)] Portal returned error: org.freedesktop.portal.Error.InvalidArgument: invalid filter: name is empty

AndreG-P commented 1 year ago

Confirm too. Win 10, KBD67MKIIRGBV3, Via Firmware Protocol 11.

Click on save generates an empty (0 byte) file. Click on load does work (loaded on old file).

kfarivar commented 5 months ago

Same issue in Ubuntu 22.04 an VIA N3

nicholasss commented 2 months ago

Issue is occuring for me with the electron app. Debian 12 (just installed yesterday with KDE) Iris rev. 8 VIA .deb version 3.

However, I was did download chrome and it just downloaded fine. Is there a place to look for log files?

dickrp commented 2 months ago

Same thing here. Clicking save does nothing. OpenSUSE Tumbleweed current. Iris rev 8.

gacallea commented 1 week ago

same here: I can't save. Load works fine.

macOS Sonoma 14.6.1 Brave 1.69.162 https://usevia.app/ Keychorn K3 Pro ANSI RGB Via firmware protocol 9

ndavd commented 5 days ago

Same issue here. Upon opening the console it says User cancelled save file request, even though no dialog pops up.

ndavd commented 5 days ago

Same issue here. Upon opening the console it says User cancelled save file request, even though no dialog pops up.

This error message can be found on the source code of the app in https://github.com/the-via/app/blob/d76f990104124c97e290e584a56622f5134b3c8f/src/components/panes/configure-panes/save-load.tsx#L140:

    try {
      const handle = await window.showSaveFilePicker({
        suggestedName,
      });
      const encoderValues = await getEncoderValues();
      const saveFile: ViaSaveFile = {
        name,
        vendorProductId,
        macros: [...expressions],
        layers: rawLayers.map(
          (layer: {keymap: number[]}) =>
            layer.keymap.map(
              (keyByte: number) =>
                getCodeForByte(keyByte, basicKeyToByte, byteToKey) || '',
            ), // TODO: should empty string be empty keycode instead?
        ),
        encoders: encoderValues,
      };

      const content = stringify(saveFile);
      const blob = new Blob([content], {type: 'application/json'});
      const writable = await handle.createWritable();
      await writable.write(blob);
      await writable.close();
    } catch (err) {
      console.log('User cancelled save file request');
    }

So something's failing on that code block...

Unfortunately, I haven't been able to run the project locally and debug the issue myself as I'm getting error after error when running the API, for example: No usable version of libssl was found.

UPDATE: Ended up extracting the real error in the live application

image

That's it, they are using an experimental method of the Web API and its availability is still extremely limited: https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker

Solution

Use one of the browsers that support the window.showSaveFilePicker method or ideally replace it with a suitable alternative that is well supported. image