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

Bug: CMS Language selector disappearing #780

Open
bumbus opened this issue Feb 16, 2023 · 8 comments
Open

Bug: CMS Language selector disappearing #780

bumbus opened this issue Feb 16, 2023 · 8 comments

Comments

@bumbus
Copy link
Contributor

bumbus commented Feb 16, 2023

There seems to be a bug with the language selector in the CMS, after certain actions it just disappears. This happened after Updating to SilverStripe 4.12. It seems to affect both Fluent versions 5 and 6.
For now I have not figured out what exact actions trigger the dissapearance.

___SS_FLUENT_BUG.mov
@kevingroeger
Copy link

Same issue here, happening since I upgraded to silverstripe 4.12

@tractorcow
Copy link
Collaborator

This is the CSS selector which is having the fluent locale selector appended to it.

$('.cms > .cms-container > .cms-menu > .cms-panel-content').entwine({

If this has changed the selector might break.

@kinglozzer
Copy link
Contributor

I’m also seeing this in 5.0.0-beta3 and Fluent 7.0.0-beta1, when the dropdown disappears the class names in the selector mentioned above are all there so everything looks to be correct... I’m also having real trouble nailing steps to reproduce though!

@kinglozzer
Copy link
Contributor

@kinglozzer
Copy link
Contributor

After clicking about a thousand times, I have a little more info... I hacked in a console.log(window.ss.config.sections) between these two lines (as that’s where the list of locales comes from to form the dropdown):

const section = 'TractorCow\\Fluent\\Control\\LocaleAdmin';
if (window

Normally, there’s an array of objects, but on the rare occasions that the dropdown fails to load instead I get:

Uncaught exception TypeError: Cannot read properties of undefined (reading 'sections')

I’m starting to think this could be because the <script> that contains window.ss.config = {...} is output after all of the dist JS files in the HTML source. I’m not sure there’s anything in Entwine that specifically waits for the document ready event before running, so perhaps it’s a new race condition introduced by a low-level change in the jQuery update from 4.12?

My purely anecdotal evidence for this is that I can’t reproduce the bug if I change this to Requirements::insertHeadTags() to force the config to be output in the <head>, guaranteeing it’s run before the script tags:

https://github.com/silverstripe/silverstripe-admin/blob/4f3240729fb5154711b2dd171bbfe9ba62a793ec/code/LeftAndMain.php#L692-L695

@jules0x
Copy link

jules0x commented Mar 14, 2023

Occurring for me as well.

composer.lock

"name": "silverstripe/framework",
"version": "4.12.3",
"name": "tractorcow/silverstripe-fluent",
"version": "5.1.1",

$('.cms > .cms-container > .cms-menu > .cms-panel-content') selects what it looks like it intends to select when I use this in the console.

I'm able to replicate it most easily when editing elemental elements that do not open inline.

@RVXD
Copy link
Contributor

RVXD commented Mar 16, 2023

Hope this can be fixed. Seems to be a timing issue.

@jules0x
Copy link

jules0x commented Mar 19, 2023

Thanks @kinglozzer a composer update pulls silverstripe/admin 1.12.5 and your fix has resolved the issue.

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

No branches or pull requests

6 participants