-
Notifications
You must be signed in to change notification settings - Fork 108
dualsync remote/local options confusing #12
Comments
local and remote options are meant to use only when you want local OR remote. To use both (dualStorage default behavior), simply remove local: true and remote: true configurations. |
My suggestion is to combine local and remote options into single storageMode option. This could have values 'local', 'remote', or 'default'. I think it would clarify the options. |
@apaatsio Yes, something like that might indeed be clearer. |
+1 |
+1 |
I would accept a pull request that makes these options work in a more sensible way. |
+1. I believe this whole aspect requires auditing and possibly polishing up. I'd like to be able to force I'm now dealing with a behavior that in my opinion is a major bug: when I start my app and issue a I'll try to find some time to fix these things myself. (If this is too off for this issue, please let me know and I'll open a new one.) |
Yes, I think this is deserving of discussion in a new issue. I appreciate |
@eladxxx in elad@4f7bd41 (currently unmerged) added the ability to specify
My thought is that the new |
The only potential use case might be data you never wish to sync, but It may make sense to collapse the two options into a single enum-like flag, On Saturday, 10 May 2014, Edward Anderson [email protected] wrote:
|
The use case was exactly as @lucian1900 explained, local-only data. So, the logic would be: |
If data is local only, I can't see any harm in marking it dirty, as that would just cause it to always work locally. Then if the model later changes to not be local-only, the local data will already be marked dirty and require a sync. As it is now, dualstorage would incorrectly assume that the local data is in sync with the remote. We don't explain in the readme that setting Any objections to moving to this?
Is this too complex? Is it more intuitive? It would be nice to make it a single option/attribute/method, but that will require a major API bump. |
Hello, I don't mean to interrupt, but I would just like to add that I find the above a bit too complex. I don't think there's a way I could remember all of that and the fact we need to clarify what each combination does might be a hint that there are too many combinations. :) Personally, I'm not sure there's a use case for all combinations. For example in my app the only flag I really wanted was If this aspect is to be polished, at the very least the |
I agree that it seems complex. My foremost goal for the near-term is to not break the existing API, and also make it not confusing. Maybe the right thing to do instead is deprecate (and keep until the next major version) the local and remote options and attributes, and add a single option/attribute that replaces the two, called Please give me your thoughts on my proposal and these new names. |
Agreed. If you want to change the dirty model behavior then there should be an explicit option to deal with it. E.g., something like markDirty. @nilbus if you are worried about maintaining backwards compatibility, you can always do something like this: if options.storageMode is 'local' or options?.local
storageMode = 'local'
else if options.storageMode is 'remote' or options?.remote
storageMode = 'remote'
else
storageMode = 'default' |
I agree, and unless someone comes up with a use case for non-dirty local records, I don't think such a mode should be supported. As for naming, I like I also think @reubano's backward compatibility layer is a good idea. |
For models where both properties local and remote are specified, the case where local==true and remote==true causes function dualSync to only execute the onlineSync method.
My suggested replacement, which also allows you to pass options.local as a working parameter and make it a little bit more readable is:
The text was updated successfully, but these errors were encountered: