-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Font preferences #437
Add Font preferences #437
Conversation
gui/src/lib/preferences.ts
Outdated
|
||
const key = 'io.deref.exo/preferences'; | ||
|
||
type Preferences = Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to spell out the keys explicitly:
interface Preferences {
'main-font-size': string;
...
}
on:click={() => { | ||
theme.apply('auto'); | ||
preferences.reset(); | ||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of the timeout here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem as though there is some sort of hidden race condition here, where the form's dirtyPrefs
are set to the non-reset version of $preferences
before the reset actually happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another alternate solution would've been to just reload the window after a reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solving a race condition by adding a timeout is almost never the right solution :-P
We should understand what is going wrong. I suspect that this code can be simplified a fair bit with the appropriate Svelte idioms.
|
||
type Preferences = Record<string, string>; | ||
|
||
let dirtyPrefs: Preferences = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make Preferences an interface with explicit keys, then this may have to become Partial<Preferences>
Thanks for the review @brandonbloom I'll address those comments and add in improved dynamic form controls for unit-suffixed numeric preferences as well as list selection inputs. |
Closing this for now. There are merge conflicts, incomplete bits, and a known bug. Rather than fixit up, it's small enough that we can re-create this after we figure out how configuration story, which might have some impact on the preferences story. |
Per user request, adds preferences to modify font-size for logs and the rest of the UI, as well as ligatures settings.
localStorage