Serenity 6.1.9 Release Notes (2022-10-02)

We'll publish these release notes for versions that deserve more explanation than short descriptions available in our change log.

Enabled Source Generators (StartSharp)

Serenity.Pro.Coder package which contains 4 source generators is enabled by default in projects created from StartSharp template v6.1.9+

These source generators that are provided in Serenity.Pro.Coder does what sergen's mvc, clienttypes and servertypings command does without having to run them manually, or build the project. There is also a RowFields source generator, which reduces amount of code when defining or modifying row classes.

All these magically work in Visual Studio (and Code) while you are modifying your C# / TypeScript classes. No modify, build, transform, use generated code, build again cycle is required.

See the blog post https://serenity.is/blog/2022/10/09/source-generators for more information on our source generators.

Removed JSRender Reference

In very old Serenity versions (before 2.9.10, 6 years ago), we used the JSRender library for dialog and other templates that used double brace placeholders like {{text:Some.Text}} (https://www.jsviews.com/)

We don't think anyone uses them for a long time, but we kept it in our corelib code since for compatibility reasons.

We are now removing Q.jsRender method and support for legacy syntax like {{text:Some.Text}} in our dialog templates.

If you are still using that somewhere in your old applications, please convert your template to a modern style in your DialogClass.getTemplate method like below:

class SomeDialog {
    getTemplate() {
        return `<div>${Q.text('Some.Text')}</div>`;
    }
}

Moved idPrefix Up to Widget Class from TemplatedWidget

We have a TemplatedWidget class, that is also base class for TemplatedDialog, PropertyDialog, EntityDialog etc.

This class has a idPrefix property, that is generated via uniqueName + '_'. We are now moving it up to widget, so that it can also be used by other widget classes that does not derive from TemplatedWidget.

It should not be a breaking change for anybody but it will allow us to use idPrefix in widgets that does not need templating system.

Introduced renderContents method in Widget Class

A method with renderContents name is added to the widget class. This method has an empty body but can be overridden by derived classes. For example, TemplatedWidget now overrides this method to apply its template to the widget's element. Before, it was done in the TemplatedWidget's constructor.

It should not be a breaking change and there are two reasons for this new function.

  • Derived classes can render their contents by overriding this method, potentially with innerHTML, React etc. without having to change the constructor.
  • Sub classes of TemplatedWidget can completely disable templating system, by simply overriding this method and leaving it empty or not calling super.renderContents()

We're gradually hoping to remove legacy template mechanism, especially ones that use Template files (.ts.html etc.) but we can't remove TemplatedWidget class for compatibility reasons.

Q.Config.responsiveDialogs is True by Default

In Serenity 2.1.3 (about 6 years ago), we added a responsive dialogs configuration option to Q.Config so that newer applications can enable responsive dialogs (e.g. better layout in mobile etc.) by default by setting it to true. But the default value for that was false so that we didn't break compatibility with legacy applications that use other mechanisms.

And newer Serene / StartSharp applications had a line in their ScriptInitialization.ts setting it to true:

Q.Config.responsiveDialogs = true

We think nobody wants or uses legacy non-responsive dialogs anymore, and their CSS is probably no longer working properly.

So we changed the default to true. This can only be a breaking change for very old applications (more than 6 years, probably none) but they can simply set Q.Config.responsiveDialogs = false in their ScriptInitialization.ts to get legacy default.

Others, can simply remove that line in ScriptInitialization.ts as that is the default in Serenity.Scripts 6.0.9+

We'll remove that flag in the future completely. Please let us know in Serenity discussions if you still have non-responsive dialogs.

Made Use of Texts Helpers in Script Code (StartSharp)

We used to have code like following scattered through StartSharp, mostly in membership related code:

return Q.format(Q.text('Validation.MinRequiredPasswordLength'), 7);

Q.text function allows us to get a localized text by its key, but it does not have any intellisense support. Luckily, sergen (and now source generators) produce a Texts class for having strongly typed access to local texts. So we are now making use of that in our code (where possible):

return Q.format(Texts.Validation.MinRequiredPasswordLength, 7);

Fixed a Rare Case for ESBuild

If you upgraded your project using stargen or a manual method to 6.1+, you may know that we are now using modular TypeScript and have esbuild configured via package.json and a tsbuild.js. We'll be moving tsbuild.js itself into a npm package in the future once it is stable and, but for now we have to apply fixes to tsbuild manually / via stargen.

We'll also add an auto watch feature (you have to manually run node tsbuild --watch for now in console to get compile on save)

If you don't have any modular TypeScript files in your projects (can happen on first migration), you would get an error from esbuild during build as the output directory would not exists (nothing to output).

So we changed the line below:

if (!outputs)

with

if (!outputs || !existsSync(build.initialOptions.outDir))
    return;

Fixed Serenity.SummaryType Enum Being not Available in Some Cases

During modular TypeScript transition Serenity.SummaryType enum registration was lost in recent releases. If you used it anywhere and got an error, just update to 6.1.8+.

Fixed iFrameDialog

When an error occurs during an AJAX call, and the server returns some HTML, we use Q.iFrameDialog to show the HTML. But in recent versions it had a script error when Bootstrap dialogs are enabled, so the error could not be displayed properly.

Source Mapping for Serenity CoreLib is Fixed

Due to the way we inject TypeScript lib (tslib.js) to our Corelib, the source mapping indexes was shifted before, so when debugging in Chrome etc, while source mapping is enabled, you would get invalid stack traces, and putting break points would result in some unrelated code to be marked in TypeScript. This should be fixed in 6.1.8.