keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
387 stars 107 forks source link

feat(developer): Add option to clear data when shutting down Keyman Developer Server #7805

Open MattGyverLee opened 1 year ago

MattGyverLee commented 1 year ago

Describe the bug

In previous versions of Keyman before the rebuild when I had to use Browser tools to emulate Android, I believe the web debugger only ever showed the keyboard you were actively debugging while Keyman was open (unless you had multiple packaged together).

Since I started testing in 16 (currently 16.0.109), the debug window keeps filling up with old keyboards I have debugged on previous days, even after a restart.

In this screenshot, after a fresh restart, you can see that I'm only debugging french_model, but you also see both of my Cameroon keyboards. image

Since I have multiple keyboards, I have to select the keyboard every time I load the browser, which is a small annoyance. Is this a cache-clearing bug that I've found or a new feature??

Also, where is the web server cache stored if I did want to inspect it?

Note: I post on the community when I think the solution might reasonably help others, and here when it's a directed conversation with you folks.

Reproduce the bug

  1. Compile a touch keyboard and test it in your browser.
  2. Restart the computer.
  3. Open Keyman Dev and a new keyboard.
  4. Compile and test in the browser.
  5. Notice that both keyboards are available from the dropdown.

Expected behavior

I would expect the caches to be cleared when the debugger closes.

Related issues

No response

Keyman apps

Keyman version

16.0.109

Operating system

Win 11 22H2

Device

Lenovo c930

Target application

Chrome or Edge

Browser

Chrome or Edge

Keyboard name

french_model, Cameroon Qwerty, etc.

Keyboard version

No response

Language name

No response

Additional context

No response

MattGyverLee commented 1 year ago

A further comment, the new debug system seems to make it MUCH easier to test CSS changes. With much older versions (12-14, maybe), the Keyboard would update, but I sometimes had to clear the browser's cache to force a CSS change.

To be clear, I'm not saying that the tool fails to update when recompiled, just that it seems not to garbage collect when we stop debugging. Since that now seems to happen in the "Keyman Desktop Server", I expected a reboot of the computer or the server would clear the server cache.

mcdurdin commented 1 year ago

This is by design. We designed Keyman Developer Server to remember your session and be robust over restarts and Keyman Developer sessions. It can run entirely independently of Keyman Developer IDE and actually runs on Linux and macOS as well (although obviously without the benefits of integration with the IDE).

It will keep up to 10 recently tested keyboards, packages, and models in its list.

Once you've loaded a keyboard or model for testing, you'll notice that keyboards and models are automatically reloaded when you recompile them -- you don't even need to click 'Test Keyboard' in the IDE again.

It would be possible to add an option to 'Clear data store when shutting down Keyman Developer Server' if that would be desirable. However, the intended pattern of use is to leave it running and self-managing.

Future versions of Keyman Developer are likely to shift more and more of the design tooling into the web interface, making it possible to use Keyman Developer on other platforms and even entirely online.

Finally, the cached keyboard data is stored at %appdata%\Keyman\Keyman Developer\Server\cache, and the cache metadata and config data is in the parent directory.

MattGyverLee commented 1 year ago

Thanks, this helps me understand. It makes sense to be able to compare a few KB's.

A bit of background, I was working with a dozen offline users in 16.107 Developer today (that's the version I installed for them a few days ago), and we were having issues with touch keyboard updates not showing up in the browser on nearly half of the computers even though compilation completed successfully. I was curious if my observation showed a wider issue. Testing tonight with 16.109 on my machine, all seems well. 16.110 just downloaded, so I'll test tonight and give them that tomorrow. If I can reproduce the non-update bug again, I'll try to capture it and write it up.

mcdurdin commented 1 year ago

If I can reproduce the non-update bug again, I'll try to capture it and write it up.

Thanks! You might want to check the Developer Tools in your browser to see if there are any reported errors; the log available in the Keyman Developer icon in the tool tray if you select 'Show Console' from right-click menu can also help.