Skip to content
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

Fix: Don't set dirty flag when shadow tiddler changes #8903

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

Rhys-T
Copy link
Contributor

@Rhys-T Rhys-T commented Jan 23, 2025

Adds shadow and normal flags to each entry in changedTiddlers, indicating whether the corresponding version of the tiddler has changed. Makes the saver handler ignore any changes that aren't flagged normal.

Fixes #8902.


I've tried this instead of changing $:/config/SaverFilter to exclude shadows, and it seems to be working properly for me. I haven't tested it extensively, however.

Copy link

@Rhys-T It appears that this is your first contribution to the project, welcome.

With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see contributing.md).

Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit 6cd2c49
🔍 Latest deploy log https://app.netlify.com/sites/tiddlywiki-previews/deploys/67928e46cb9d390009af142b
😎 Deploy Preview https://deploy-preview-8903--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Adds `shadow` and `normal` flags to each entry in `changedTiddlers`,
indicating whether the corresponding version of the tiddler has changed.
Makes the saver handler ignore any changes that aren't flagged `normal`.

Fixes TiddlyWiki#8902.
@Jermolene
Copy link
Member

@Rhys-T It appears that this is your first contribution to the project, welcome.

Apologies, that message is appearing because I hadn't merged tiddlywiki-com into master since your CLA signature was merged. Should be fixed for your next commit.

@Rhys-T
Copy link
Contributor Author

Rhys-T commented Jan 23, 2025

No, no, it's right, I haven't actually gotten to signing it yet. Give me a minute…

@Jermolene
Copy link
Member

Thanks @Rhys-T that's an interesting approach and I don't see any obvious flaws. Let's give it some testing.

@Rhys-T
Copy link
Contributor Author

Rhys-T commented Jan 23, 2025

Submitted the CLA signature as #8904, but I'm not 100% sure I did it correctly. I missed the part about using GitHub's edit button to do it, and created the branch and PR the old-fashioned way. Do I need to redo it so it has a Git-level digital signature or anything? Edit: Resolved in other thread.

@Rhys-T Rhys-T marked this pull request as ready for review January 23, 2025 19:36
Copy link

Rhys-T has signed the Contributor License Agreement (see contributing.md)

@pmario
Copy link
Member

pmario commented Jan 24, 2025

I did skim the code, and I am not sure about the initialisation. Especially if internal API is used with 3rd party plugin code. -- So IMO a bit more testing is needed.

@Rhys-T
Copy link
Contributor Author

Rhys-T commented Jan 24, 2025

I tried to keep everything as compatible as I could. enqueueTiddlerEvent will just assume the event is about a normal tiddler unless told otherwise, and as far as I understand it, the only thing that should directly mess with shadow tiddlers is the plugin-unpacking code. The changes object is getting new properties, but all the existing ones should be exactly the same as before. Still, I agree that it should probably be tested more thoroughly. I'm not that familiar with TW's internals, and it's entirely possible I'm missing something.

@@ -75,7 +75,7 @@ exports.startup = function() {
$tw.wiki.unpackPluginTiddlers();
// Queue change events for the changed shadow tiddlers
$tw.utils.each(Object.keys(changedShadowTiddlers),function(title) {
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]);
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I forgot to leave off the space after the comma to match the rest of the code. Is it worth another force-push, or should I leave it alone?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A standard push should be fine.

@pmario
Copy link
Member

pmario commented Jan 25, 2025

I did some more tests with overwritten shadow tiddlers and it seems to work.

@Jermolene -- It looks good to me.

@Jermolene
Copy link
Member

Thanks @Rhys-T

@Jermolene Jermolene merged commit 94b325f into TiddlyWiki:master Jan 25, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Updating info tiddlers using the callback sets the dirty flag
3 participants