-
Notifications
You must be signed in to change notification settings - Fork 113
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
Standard order of tiddler attributes storage (to prevent unwanted diffs) #306
Comments
Hi Pengju, thanks for creating this issue, I'm aware of it and even have a draft solution for it (in fact, it's included into SUP) which includes sorting of non-standard fields. I haven't included it into the core yet for 2 reasons:
So I won't be changing this right away, but once I have time for the necessary research (or may be somebody else helps with that), this can be pushed forward. |
I've experienced this before when viewing other people's TiddlyWiki, then their cookie values make their way into my personal TiddlyWiki. The easiest way to replicate this is to download Okido's nwSaver (TW version 2.9.4), then visit your own TiddlyWiki, make a quick edit and save. I tried this with a TW file using 2.9.2 and I did not have the issue, but with another TW file running 2.10.0 I did start seeing these attributes. Using standard download saving, no saver configured.
These are my default cookie options. then also my zzConfig
|
Hi @markkerrigan , I don't think it's useful to look for exact scenarios here: the thing is, the store.forEachField call uses the for..in loop to iterate custom fields and JS (EcmaScript) doesn't guarantee the order of such iteration (it may depend on browser, on the order of adding properties (fields in this case), on the context, etc). So yeah, to avoid inconsistencies, we need explicit sorting here; as for the standard fields, they are concatenated in a fixed order |
Right my issue is I don't understand why the server.page.revision attribute is added, only that it seems to be cookie related. |
Hi, @markkerrigan, as far as I can see, the core sets the |
This issue surfaces to me when I'm developing/testing a plugin SwitchPalettePlugin. You won't notice that if you are a normal user.
When I save a TWC file, and use
git diff
to check the difference, I found many unnecessary changes are made to the order of html attributes of some tiddlers, even if the content of these tiddlers (title, tags, text) are never changed by the user.Here are some examples:
ColorPalette
title="ColorPalette" modifier="Pengju" created="202401260942" modified="202401271137" is.dark.mode="true" from.palette="ColorPalette (pengju dark)" server.type="file" server.page.revision="202401270237" changecount="2"
title="ColorPalette" modifier="Pengju" created="202401260942" modified="202401271137" changecount="2" server.page.revision="202401270237" server.type="file" from.palette="ColorPalette (pengju dark)" is.dark.mode="true"
TiddlerInFilePlugin
title="TiddlerInFilePlugin" modifier="Yakov Litvin" created="201808191403" modified="202212060812" tags="systemConfig" content-type="text/javascript" changecount="274"
title="TiddlerInFilePlugin" modifier="Yakov Litvin" created="201808191403" modified="202212060812" tags="systemConfig" changecount="274" content-type="text/javascript"
You can see that the attributes values remain untouched but what have been changed are the orders only.
Interestingly, attribute order of some tiddler never change. Those tiddlers include
DefaultTiddlers
,ExternalTiddlersList
,StyleSheet
, etc.Because all the intact tiddlers only have normal attributes including
title
,creator
,modifier
,created
,modified
,tags
(changecount
seems like a second-class-citizen, too) and contaminated ones have non-official second-class-citizen attributes likeserver.type
,from.palette
, my guess is that the order of keys of official attributes are kept while others aren't.While this doesn't seem a big deal, it does have some negative effect in some situations. Imagine you like to use git to track the changes to your TWC html file, the trial change of attribute order will make your tracking much harder (you have to look for real changes hidden in many non-sense ones).
The text was updated successfully, but these errors were encountered: