C#Bot Release 2.6.0.0

Features

Upgrade to from React v16 to React v17

React v17.0 has no new features, but instead enables gradual upgrades. We don’t expect for there to be breaking changes due to the upgrade to React v17.0.

Please read more about React v17.0 here: React v17.0 Release Notes

As part of this, we have also upgraded most of the node dependencies to their latest version in package.json.

Improvements

  • Added file size limit to the file upload component (feature request)
    • This can be configured by passing a maxFileSize prop which is the size limit in bytes.
  • Upgraded node package dependencies to later versions.
  • Upgraded from Node SASS to Dart SASS.
  • Changed from ‘Slash as Division’ to Math.div() for scss.
  • Prevented Username Enumeration with registration.
  • Registered RazorLightEngine interface instead of implementation.

Resolved defects

  • Protected region in a question tile which does not have an end tag.
  • Display error on cancellation request in CRUD.
  • Fixed timeline tests that would fail to compile on some security models (bug report)

Migration Path

Dart SASS

We have upgraded from Node SASS to Dart SASS in this release. Dart Sass is the primary implementation of Sass, which means it gets new features before any other implementation.

Part of the upgrade includes a move from using ‘Slash as Division’ to the new ‘math.div()’ function. This means scss that used to look like this:

$admin-width: floor(100 * $admin-i * 100/ $admin-grid-columns) / 100;

not looks like this:

$admin-width: math.div(floor(100 * $admin-i * math.div(100, $admin-grid-columns)), 100);

Read more about Dart SASS here: Dart SASS

Read more about Sass Division here: Breaking Change - Slash as Division

Apollo-boost

The package apollo-boost has been replaced with apollo/client. So for example if you were importing gql from apollo-boost like this:

import { gql } from 'apollo-boost';

you will need to replace it with this:

import {gql} from '@apollo/client';

If you do not wish to upgrade you can bring the apollo-boost package back into package.json using one of the protected regions:

"apollo-boost": "^0.4.4",

React Apollo

The package react-apollo has been replaced with apollo/client.

Components that use Query import for react-apollo will need to be replaced with functional components that use the useQuery hook. For example:

import { Query } from 'react-apollo';

<Query
	fetchPolicy="network-only"
	notifyOnNetworkStatusChange={true}
	query={this.props.customQuery || fetchAllQuery}
	variables={this.constructVariables()}>
	{this.props.children}
</Query>

gets replaced with:

import { useQuery } from '@apollo/client';
const result = useQuery(customQuery ?? fetchAllQuery, {
	fetchPolicy: 'network-only',
	notifyOnNetworkStatusChange: true,
	variables: constructVariables(props),
});

If you do not wish to perform this migration, you can bring the react-apollo package back by using one of the protected regions in package.json.

"react-apollo": "^2.5.5",

Navigation Styling

The navigation component has been updated to use button tags instead of a tags for items that are not links. This is to match the semantic HTML guidelines for tag usage. Any styles that targeted the a tags in this component should instead target the .nav__link class instead.

Significant File Refactors

There have been considerable refactors in:

  • GraphQLController.cs,
  • EntityCollection.tsx,
  • EntityEdit.tsx,
  • EntityAttributeList.tsx, and
  • FormVersionCollection.tsx.

If you use protected regions in these files, there is a good chance upgrading will cause compile errors for your application. The best way to deal with this is to:

Option 1

  • Make a copy of your edited versions of these files.
  • Remove the bot-written warning from the copied files to prevent the bot deleting them.
  • Turn the protected regions off in the original files.
  • Upgrade to 2.6.0.0
  • Copy your changes back into the generated files.

Option 2

  • Create a branch off develop.
  • Turn the protected regions off in the develop branch.
  • Upgrade to 2.6.0.0
  • Copy your changes back into the generated files.