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

(feat):App extras exceptions #5621

Merged
merged 26 commits into from
Feb 13, 2024
Merged

(feat):App extras exceptions #5621

merged 26 commits into from
Feb 13, 2024

Conversation

dobri1408
Copy link
Contributor

In situations where we do not want the appExtras rule to apply universally to all routes matched by a certain rule, the addition of an exclude property could be beneficial. This property would provide a way to specify exceptions to the rule. For instance:
{ match: '*', exclude: '/**/diff', component: RemoveSchema, }
To address this scenario, where the goal is to apply a rule to all pages except for the "history diff" page, incorporating an exclude property into the rule configuration is an effective solution.

Copy link

netlify bot commented Jan 14, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 896f036
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/65be8051a663d60008f22146

Copy link

netlify bot commented Jan 14, 2024

Deploy Preview for volto ready!

Name Link
🔨 Latest commit 896f036
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/65be8051807a8b0007528641
😎 Deploy Preview https://deploy-preview-5621--volto.netlify.app/recipes/appextras.html
📱 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.

@dobri1408
Copy link
Contributor Author

Also, if this is merged, can we backport it to version 16.x?

@stevepiercy
Copy link
Collaborator

This needs narrative documentation. See https://6.docs.plone.org/volto/recipes/appextras.html.

I would like to see an exclude code example, modeled on the default code example.

Additionally, we need to include a placeholder for this admonition, especially if it gets backported.

```{versionchanged}17.x.x and 16.x.x
Added the `exclude` property.
```

Side note, that page has some syntax and grammar issues that could be addressed at the same time.

Copy link
Sponsor Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

https://github.com/plone/volto/pull/5621/files#diff-76050b5a1b7f3811d861cba8076fb99be2f8162e0649b91432f7793702071078R3

The matching rule isn't correct, look at the test output, now every test returns null which means that your condition always renders true.

@dobri1408
Copy link
Contributor Author

@ichim-david, you're right, the default value was incorrect.

Copy link
Sponsor Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

@dobri1408 you need to add a test for this feature

@dobri1408 dobri1408 changed the title App extras exceptions (feat):App extras exceptions Jan 14, 2024
@@ -9,8 +9,9 @@ beforeAll(() => {
match: {
path: '',
},
exclude: '/blog',
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@dobri1408 do not put your code that you want to test inside the beforeAll call which is called for each test.
Write a new test that passes the exclude and see how it behaves leaving the other tests as they were before you worked on this feature.

@ichim-david
Copy link
Sponsor Member

This needs narrative documentation. See https://6.docs.plone.org/volto/recipes/appextras.html.

I would like to see an exclude code example, modeled on the default code example.

Additionally, we need to include a placeholder for this admonition, especially if it gets backported.

```{versionchanged}17.x.x and 16.x.x
Added the `exclude` property.

Side note, that page has some syntax and grammar issues that could be addressed at the same time.

@dobri1408 don't forget to also do this step that @stevepiercy mentioned that you need todo

Copy link
Contributor

@tiberiuichim tiberiuichim left a comment

Choose a reason for hiding this comment

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

I think I would prefer a setting called ignore, rather then exclude.

@sneridagh
Copy link
Member

out of curiosity, the react-router-dom matchPath support regex, right? Can't we build a regex that does this? (I am not a regex nerd, but still...)

@dobri1408
Copy link
Contributor Author

Hi @sneridagh! This was my first thought, but unfortunately no, it doesn't support regex so we have to introduce this new property.

@sneridagh
Copy link
Member

@dobri1408 please perform the suggestions from @ichim-david and @tiberiuichim I think they are valuable.

Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

These suggestions might need more revision, and should be reviewed by someone who can make sure the rewording I suggested aligns with the code functionality. Thank you!

docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
packages/volto/news/5621.feature Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
dobri1408 and others added 10 commits January 29, 2024 10:53
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

One more change, after checking the preview on Netlify.

docs/source/recipes/appextras.md Outdated Show resolved Hide resolved
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

Thank you!

@ichim-david
Copy link
Sponsor Member

@sneridagh this is ready to merge for some time and everyone gave their approval, can we merge this or do you want to merge something else before?

@davisagli davisagli merged commit de84c6b into main Feb 13, 2024
66 checks passed
@davisagli davisagli deleted the app-extras-exceptions branch February 13, 2024 16:40
sneridagh added a commit that referenced this pull request Feb 15, 2024
…bars-et-al

* main: (56 commits)
  Exclude chromewebstore from linkcheck (#5761)
  (feat):App extras exceptions (#5621)
  Add VOLTOCONFIG Env Var (#5752)
  PoC - Vite and Tanstack Router, Query and `@plone/client` in SSR mode. (#5750)
  Update links to Redux and React developer extensions for Chrome (#5757)
  Overhaul environment variables documentation (#5736)
  Mention what version the 'links and references' view was added (#5756)
  Add wait commands to flaky block-listing tests (#5753)
  Fix logging in test-acceptance-server commands (#5748)
  Replaced outdated diff with a link to the current `package.json` on t… (#5728)
  Listing Block render of initial results in SSR (#5689)
  Fix @plone/volto-slate path in moduleNameMapper (#5743)
  Added global form state. (#5721)
  Release generate-volto 9.0.0-alpha.5
  Fix tests in projects that involves TS files (#5738)
  Reorganize README, merging content into authoritative locations (#5511)
  Release 18.0.0-alpha.10
  Release generate-volto 9.0.0-alpha.4
  Release @plone/registry 1.2.2
  Enhance release in @plone/registry
  ...
sneridagh pushed a commit that referenced this pull request Feb 18, 2024
Co-authored-by: ichim-david <ichim.david@gmail.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants