Giter Club home page Giter Club logo

Comments (11)

Simon-Laux avatar Simon-Laux commented on May 27, 2024

we have a cache/store for some settings in desktop, is there an event when it changes?

the cache is there to get core values faster, because it is sync, while the core api is async, though we could probably change the code to have less places that rely on it with the cost that we may have to add some loading delays.

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

Unfortunately, no special event is emitted for this. Only IncomingMsgBunch is emitted for sync messages, can it be used to update the displayname and other things (e.g. the avatar) that can be synchronised?

from deltachat-desktop.

Simon-Laux avatar Simon-Laux commented on May 27, 2024

relying on that event would be rather hacky (naming has only weak link to meaning), but could work, but an event that indicates that some config changed would be even better.

from deltachat-desktop.

Simon-Laux avatar Simon-Laux commented on May 27, 2024

so @farooqkz listen for IncomingMsgBunch in settings store and reload the whole message store on that event, don't forget to add a comment that explains that there is no dedicated event for this yet and maybe link to this issue.

Was considering to do it myself, but I don't want to steal your issue this time ;)

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

Yes, relying on IncomingMsgBunch isn't a good idea, because it only means that some message is received, but it might not be yet applied. So, we can have a race.

EDIT: Maybe indeed add some ConfigChanged event instead of adding temporary hacks? @r10s would it be useful in mobile apps?

EDIT: Though, for self-avatar we already have SelfavatarChanged. Thinking about DisplaynameChanged then, but not sure we need so fine-grained events...

from deltachat-desktop.

r10s avatar r10s commented on May 27, 2024

@r10s would it be useful in mobile apps?

no. we do not cache config values on mobile, this is not needed, things are fast enough. iirc, not caching is no option as all calls are async on desktop? or did that change meanwhile?

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

So, i'm going to add some event like

ConfigChanged {
    key: Config,
    val: Option<String>,
}

It will also replace SelfavatarChanged. But for some time there will be both for compatibility.

EDIT: But then we're going to have some useless events for e.g. LastHousekeeping. So, i'd rather add an event only for synced config keys, but do that on both sides (sender and receiver) for uniformity.

EDIT: How about ConfigSynced (with the same params)?

from deltachat-desktop.

Simon-Laux avatar Simon-Laux commented on May 27, 2024

EDIT: How about ConfigSynced (with the same params)?

I agree, that would be nice, though value is probably not needed, we can always fetch the newest version of it with a core call.

iirc, not caching is no option as all calls are async on desktop? or did that change meanwhile?

if we do loading states (or react suspense rendering) for places where it is needed we could avoid caching those, but would need some refactoring and maybe not applicable for all cases where the settings store is used.

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

I agree, that would be nice, though value is probably not needed, we can always fetch the newest version of it with a core call.

Decided not to add a value, otherwise it would be logged which might not be good for privacy when sharing logs

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

Merged the core PR

from deltachat-desktop.

iequidoo avatar iequidoo commented on May 27, 2024

Merged another core PR fixing the previous one, now should work

from deltachat-desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.