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

How to set default modal timeout or handle timeouts correctly? #1363

Open
krissik opened this issue Jan 22, 2024 · 3 comments
Open

How to set default modal timeout or handle timeouts correctly? #1363

krissik opened this issue Jan 22, 2024 · 3 comments

Comments

@krissik
Copy link

krissik commented Jan 22, 2024

Sometimes we see "error happened timeout do something" messages in Browser Console after clicking "Save" on a modal. We are wondering if it is possible to increase the default value of 5000 which is set here . It is far to low for us b/c diazo is sometimes very slow.

Or maybe we need to handle it in some way, b/c there is options.onTimeout here ?

We hit the timeout while editing values in portal registry using /portal_registry view and while editing properties of pages and folders which have a mosaic layout.

@krissik krissik changed the title How to set default modal timeout or handle it correctly? How to set default modal timeout or handle timeouts correctly? Jan 22, 2024
@petschki
Copy link
Member

petschki commented Jan 22, 2024

The general timeout setting for pat-plone-modal is: {'actionOptions': {'timeout': 5000}}
There are "global" pattern options in the config registry set via plone.patternoptions ... you can adjust the default value to:

{
    'pickadate': '{"date": {"selectYears": 200}, "time": {"interval": 5 } }',
    'plone-modal': '{"actionOptions": {"displayInModal": false, "timeout": 30000}}'
}

you see these options are set on the <body> tag, because patternslib "acquires" the options from its parent nodes ...

NOTE: These options are generated by @@plone_patterns_settings defined in Products.CMFPlone.patterns.view.PatternsSettingsView so if you need some extra logic you can override this browserview with your own ...

@krissik
Copy link
Author

krissik commented Jan 23, 2024

Many thanks. I have changed plone.patternoptions in portal_registry but still get timeout error. I have saved the setting (there was an timeout error but it was saved in background) and reloaded portal_registry. Then I checked that the new timeout is set in source code of the page (which was the case)

pat-modal-registry-sourcecode

opened the modal to change plone.patternoptions again and saved it without changing something.
I still get the timeout error after 5 seconds and the modal is not closing.

pat-modal-registry

Did I miss something?

@petschki
Copy link
Member

petschki commented Jan 23, 2024

Aha. Just found out, that the portal_registry links have the class pat-modal and not pat-plone-modal. So this is the default patternslib modal and (of course) doesn't get the options from data-pat-plone-modal 🤔

Unfortunately I didn't find any timeout option here https://github.com/Patternslib/Patterns/blob/master/src/pat/modal/modal.js ... but maybe @thet can add some more insights on this?

NOTE: you can add ?loglevel=DEBUG to your browser address and open the console. There you see the patternslib debug log and can investigate the initialized elements with their pattern options. The pattern code is instantinated as pattern-<pattern_name> attribute on the DOM element.

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

2 participants