Please follow those steps to get the idea about the problem:
Let's create a palette:
nb = CreatePalette[ DynamicModule[{}, Panel["Hello you!", ImageSize -> 500, Alignment -> Center] , SynchronousInitialization -> False, Initialization :> ( CreateDocument@CurrentValue[EvaluationNotebook[], TaggingRules] ) ], WindowTitle -> "Palette B ", TaggingRules -> {"B" -> 1123} ];And save it to users palettes directory.
palettePath = FileNameJoin[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "Palettes", "TESTPalette.nb"}]; NotebookSave[ nb, palettePath ]; NotebookClose @ nb;Reset menus to show it there:
MathLink`CallFrontEnd[ FrontEnd`ResetMenusPacket[{Automatic, Automatic}]]Click on the item or run
FrontEndTokenExecute["OpenFromPalettesMenu", FileNameTake @ palettePath]and we have it working:Close the palette and delete it.
DeleteFile @ palettePathRepeat steps 1-4 with different
TaggingRulesWindowTitle -> "Palette A", TaggingRules -> {"A" -> 1112}
The problem
Now there is a new Palette's Menu item - "Palette A" - and that notebook is opened when clicked, yet the old TaggingRules with "B" are prompted...
But the file is saved correctly:
FilePrint @ palettePathshows that there is
"A"insideTaggingRules. So"B"was somehow, cached somewhere.Also, when one opens the notebook manually or with
NotebookOpen @ paletePathit works well...The problem remains after restarting Mathematica.
The
SynchronousInitializationoption is necessary, I wasn't able to reproduce the problem without it.
What is going on and how to deal with this?


