Skip to content

Commit 11d1a4e

Browse files
authored
Merge branch 'main' into dx-1128/docs-local-icon
2 parents 6c83436 + 5fb535a commit 11d1a4e

10 files changed

Lines changed: 470 additions & 376 deletions

File tree

.circleci/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ jobs:
7878
NODE_OPTIONS: --max-old-space-size=12288
7979
executor:
8080
name: default
81-
resource_class: xlarge
81+
# gen2 is ~1.4x faster CPU at +20% credits/min. Only this job runs the
82+
# CPU-bound `yarn build`, so it's the one place the trade pays off (per
83+
# Voltaire's gen2 rollout). Fall back to xlarge if gen2 is unavailable.
84+
resource_class: xlarge.gen2
8285
steps:
8386
- checkout
8487
- attach_workspace:

bin/assert-compressed.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
22

33
#
4-
# A utility script to assert that all CSS, JS, JSON, and SVG files have corresponding .gz compressed versions
4+
# A utility script to assert that all CSS, JS, and SVG files have corresponding .gz compressed versions
55
#
66
# Usage: assert-compressed.sh
77
#
88

99
# Find all files that should be compressed
10-
FILES=$(find public -type f \( -name "*.css" -o -name "*.js" -o -name "*.json" -o -name "*.svg" \))
10+
FILES=$(find public -type f \( -name "*.css" -o -name "*.js" -o -name "*.svg" \))
1111
ORIGINAL_COUNT=$(echo "$FILES" | wc -l)
1212

1313
# Check each file for a corresponding .gz version

data/onPostBuild/compressAssets.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ const piscina_1 = __importDefault(require("piscina"));
2323
*/
2424
const onPostBuild = async ({ reporter }) => {
2525
const cwd = path_1.default.join(process.cwd(), 'public');
26-
const globResult = await (0, fast_glob_1.default)('**/*.{css,js,json,svg}', { cwd });
26+
// JSON (mostly Gatsby's page-data.json) is excluded: nginx is configured with
27+
// `gzip on; gzip_types application/json; gzip_static on;` so JSON is
28+
// live-gzipped on the way out. Pre-compressing it with zopfli was the bulk of
29+
// onPostBuild time for ~5-10% extra ratio over nginx's live gzip-6. Following
30+
// Voltaire, which dropped JSON pre-compression for the same reason.
31+
const globResult = await (0, fast_glob_1.default)('**/*.{css,js,svg}', { cwd });
2732
const files = globResult.map((file) => {
2833
return {
2934
from: path_1.default.join(cwd, file),

data/onPostBuild/compressAssets.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ import Piscina from 'piscina';
2020

2121
export const onPostBuild: GatsbyNode['onPostBuild'] = async ({ reporter }) => {
2222
const cwd = path.join(process.cwd(), 'public');
23-
const globResult = await fastGlob('**/*.{css,js,json,svg}', { cwd });
23+
// JSON (mostly Gatsby's page-data.json) is excluded: nginx is configured with
24+
// `gzip on; gzip_types application/json; gzip_static on;` so JSON is
25+
// live-gzipped on the way out. Pre-compressing it with zopfli was the bulk of
26+
// onPostBuild time for ~5-10% extra ratio over nginx's live gzip-6. Following
27+
// Voltaire, which dropped JSON pre-compression for the same reason.
28+
const globResult = await fastGlob('**/*.{css,js,svg}', { cwd });
2429

2530
const files = globResult.map((file) => {
2631
return {

data/onPostBuild/compressAssetsWorker.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ const fs = require('fs/promises');
22
const { gzipAsync } = require('@gfx/zopfli');
33

44
const options = {
5-
numiterations: parseInt(process.env.ASSET_COMPRESSION_ITERATIONS || '15', 10),
5+
// Default 1: zopfli's deflate ratio plateaus after the first iteration
6+
// (<0.5% byte savings vs. 5/15 for 25-45% more time per file). Set
7+
// ASSET_COMPRESSION_ITERATIONS higher for production if max ratio is wanted.
8+
numiterations: parseInt(process.env.ASSET_COMPRESSION_ITERATIONS || '1', 10),
69
};
710

811
const compress = async ({ from, to }) => {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"@typescript-eslint/eslint-plugin": "^5.46.1",
123123
"@typescript-eslint/parser": "^7.1.1",
124124
"autoprefixer": "^10.4.27",
125-
"babel-jest": "^30.3.0",
125+
"babel-jest": "^30.4.1",
126126
"babel-plugin-module-resolver": "^5.0.3",
127127
"babel-plugin-transform-define": "^2.1.4",
128128
"babel-preset-gatsby": "3.16.0",
@@ -137,9 +137,9 @@
137137
"fast-check": "^3.4.0",
138138
"gatsby-plugin-postcss": "6.16.0",
139139
"identity-obj-proxy": "^3.0.0",
140-
"jest": "^30.3.0",
140+
"jest": "^30.4.2",
141141
"jest-axe": "^10.0.0",
142-
"jest-environment-jsdom": "^30.3.0",
142+
"jest-environment-jsdom": "^30.4.1",
143143
"lint-staged": "^13.1.0",
144144
"msw": "^2.0.1",
145145
"postcss": "^8.5.10",

src/components/Examples/ExamplesContent.test.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('ExamplesContent', () => {
7575
});
7676

7777
it('filters examples based on product filter selection', () => {
78-
// Make the screen wider than the default of 1024px as desktop filtering only works >= 1040px
78+
// Desktop filter auto-commits at the `sm` breakpoint (768px) and above
7979
Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: 1600 });
8080
window.dispatchEvent(new Event('resize'));
8181

@@ -86,4 +86,19 @@ describe('ExamplesContent', () => {
8686
expect(screen.queryByText('Online status')).not.toBeInTheDocument();
8787
expect(screen.getByText('Member location')).toBeInTheDocument();
8888
});
89+
90+
// DX-1449: between the `sm` (768px) and `md` (1040px) breakpoints the inline
91+
// desktop filter renders without an Apply button, but selections previously
92+
// only committed at >= 1040px, leaving the filter inert in that range.
93+
it('filters examples at widths between the sm and md breakpoints', () => {
94+
Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: 818 });
95+
window.dispatchEvent(new Event('resize'));
96+
97+
render(<ExamplesContent exampleImages={exampleImages} />);
98+
const productFilterInput = screen.getByTestId('product-spaces');
99+
fireEvent.click(productFilterInput);
100+
101+
expect(screen.queryByText('Online status')).not.toBeInTheDocument();
102+
expect(screen.getByText('Member location')).toBeInTheDocument();
103+
});
89104
});

src/components/Examples/ExamplesFilter.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { navigate } from 'gatsby';
1212
import { ProductName } from '@ably/ui/core/ProductTile/data';
1313
import { MagnifyingGlassIcon, XMarkIcon } from '@heroicons/react/24/outline';
1414

15+
// Matches Tailwind's `sm` screen (768px), where the filter switches from the
16+
// mobile drawer (with an Apply button) to the inline desktop sidebar. Above
17+
// this width selections must auto-commit, since no Apply button is rendered.
18+
const SM_BREAKPOINT = 768;
19+
1520
const ExamplesFilter = ({
1621
selected,
1722
setSelected,
@@ -85,7 +90,7 @@ const ExamplesFilter = ({
8590

8691
useEffect(() => {
8792
const handleResize = () => {
88-
if (window.innerWidth >= 1040) {
93+
if (window.innerWidth >= SM_BREAKPOINT) {
8994
setExpandFilterMenu(false);
9095
}
9196
};
@@ -95,7 +100,7 @@ const ExamplesFilter = ({
95100
}, []);
96101

97102
useEffect(() => {
98-
if (window.innerWidth >= 1040) {
103+
if (window.innerWidth >= SM_BREAKPOINT) {
99104
setSelected(localSelected);
100105
}
101106
}, [expandFilterMenu, localSelected, setSelected]);

src/pages/docs/channels/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ To set a rule:
207207
<Tabs>
208208
<Tab value="dashboard" label="Dashboard">
209209

210-
In your app [settings](https://ably.com/accounts/any/apps/any/settings):
210+
In your app [settings](https://ably.com/accounts/any/apps/any/app_namespaces):
211211

212-
1. Click **Add new rule**.
212+
1. Click **Create rule**.
213213
2. Select the channel name or namespace to apply rules to.
214214
3. Check the required rules.
215215
4. Click **Create rule** to save.

0 commit comments

Comments
 (0)