Umbraco Discord wrap-up week 18
Tags: umbraco
Published: 2022-05-06 07:59:03

Every week I realize what a wealth of information gets shared in the [Umbraco Discord](https://discord.gg/umbraco) and the many things I might want to look up again later, so I've started keeping a list!

## CORS

How to modify CORS on Umbraco netcore, asks [Sean](https://twitter.com/SeanThorne).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0pphr7sktkyhsusausrn.png) 

My teammate [Paul](https://github.com/p-m-j) has the answer:

```csharp
services.Configure<UmbracoPipelineOptions>(opt => {
    opt.AddFilter(new UmbracoPipelineFilter("cors")
    {
        PostPipeline = app => app.UseCors(cors =>
        {
            cors.AllowAnyMethod()  // for example
                .AllowAnyHeader()  // for example
                .AllowAnyOrigin(); // for example
        })
    });
});
```

> Should just be able to do this in configure services (or a composer etc) 

## Modelsbuilder

[Heather](https://twitter.com/hfloyd) made me check out [Limbo Modelsbuilder](https://github.com/limbo-works/Limbo.Umbraco.ModelsBuilder): 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/goae28u2eiy55iidvgph.png)
 
While, by the way, Sean is plugging his upcoming [Codegarden](https://codegarden.umbraco.com/) talk about building the [Aardman](https://aardman.com/) website on Umbraco.

Heather notes that much of the Modelsbuilder functionality that was available in the v8 Visual Studio extension is now again available in this package.

## Element types and tags

[Søren](https://twitter.com/skttl) blogged about [bypassing (some) of our limitations](https://dev.to/skttl/bypassing-property-editor-restrictions-in-umbraco-element-types-21ko) when trying to use certain property editors in nested content / block editor.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsumqppwd8arg5n3f6m3.png)

While [Lee](https://twitter.com/leekelleher) also points out that his wonderful [Contentment](https://github.com/leekelleher/umbraco-contentment) package can use the data from property editors like the Tags editors.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4caked7fmak483erqnd4.png)
 
Lee also noted during UmbraCollab that Contentment already works with Umbraco 10, he has an [alpha release](https://github.com/leekelleher/umbraco-contentment/releases/tag/4.0.0-alpha001) out now! 

## UmbraCollab

As you may or may not know, every Thursday at 13:00 CET we get together on [Discord](https://discord.gg/umbraco) and do a bit of mob programming. This week we tried to do some Umbraco 10 upgrades. 

[Paul](https://twitter.com/codesharepaul) kicked off with what was going to be an attempt to upgrade his [Portfolio Starter Kit](https://our.umbraco.com/packages/starter-kits/portfolio-starter-kit/) and [Examine Content App](https://our.umbraco.com/packages/backoffice-extensions/ourumbracoexaminecontentapp/) to Umbraco 10. Turns out both of those "just" worked on v10 already, so there was really nothing to do, excellent!

Then I tried to upgrade my blog to v10 and ran into some problems, similar problems happened on a different test site I had laying around and it turns out I forgot to upgrade the sites to .NET 6 - after which everything just worked, smooth. Thanks [Bjarke](https://twitter.com/bjarkeberg) for the hint and for providing [the updated docs](https://our.umbraco.com/documentation/Fundamentals/Setup/Upgrading/version-specific#version-9-to-version-10). 

The recording is on YouTube: 

{% embed https://youtu.be/Q-RB0Jyq9jc?t=544 %}

## Redis

[Gareth](https://twitter.com/garpunkal) wrote a [blog post about caching Umbraco content in Redis](https://dev.to/garpunkal/umbraco-9-azure-cache-for-redis-3ipi) after getting some feedback.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnfmmujxb6behs8vjlhf.png)

##  Setting properties to read-only

Harry asked about making some properties read-only under certain conditions.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ji33cajnwpmarjq2qurc.png)

And Paul Seal reminds us of [Marc Goodson](https://twitter.com/marcemarc/)'s blogpost about his attempts at [limiting editor access by language](http://tooorangey.co.uk/posts/umbraco-v8-variants-and-limiting-editor-access-by-language-an-adventure-story/). 

## Vite

[Dan Hammond](https://github.com/dan-hammond) has been on a journey this week to get Vite to load in the backoffice and eventually seems to have gotten there with a bit of help from [Nathan](https://twitter.com/nathanwoulfe) and by orchestrating a  big hack.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyu13gj7tptbsssox99p.png)

He notes:

> In the loader:

```js
const ready = $.prototype.ready;

let queued = [];
$.prototype.ready = function ( fn ) {
  queued.push( fn );
};

$.enableReady = function() {
  queued.forEach((x) => {
    ready.call(this, x);
  })
  
  $.prototype.ready = ready;
}

let script = document.createElement("script");
script.type = "module";
script.src = "/backoffice/src/main.ts";
document.getElementsByTagName('head')[0].appendChild(script);

```

> In my Vite script:

```js
if ( $.enableReady ) {
  $.enableReady()
}
```

## Visual Studio code cleanup

Lastly, Matt Wise shared a useful link for those not yet using Rider.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpmnvn5x7nesxsm3io9u.png)

[Automatic code cleanup](https://devblogs.microsoft.com/visualstudio/bringing-code-cleanup-on-save-to-visual-studio-2022-17-1-preview-2/) on saving a file is coming to Visual Studio at last.

## That's a wrap!

Wow, that was a lot going on in just a single week! Hard to keep up.

As always, [you're welcome to join us and collaborate](https://discord.gg/umbraco) on anything you're working on in Umbraco at the moment. Or just lurk, as you can see there's a lot to learn from.

### UmbraCollab opportunity 💡

As a final note:

We are always looking for people to join us on UmbraCollab. Thursday at 13:00, strictly limited to one hours of collaborating on something. Topics can include: 

- working on a pull request
- working on a new package
- converting existing packages to a newer version
- trying out new (or old) features in Umbraco

You drive the screen and we help you out with helpful (and sometimes completely useless) comments. Usually we get pretty far in an hour and most of all we all learn something new. 

[Tweet me, DMs are open 👋](https://twitter.com/cultiv), if you would like to take the opportunity and share something interesting!