Skip to content

Commit 19d892e

Browse files
fix issue related to fullPage in mobile devices
1 parent faf602e commit 19d892e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/lib/snapshotQueue.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ export default class Queue {
170170
if (config.mobile) {
171171
const devices = config.mobile.devices || [];
172172
const orientation = config.mobile.orientation || constants.MOBILE_ORIENTATION_PORTRAIT;
173-
const fullPage = config.mobile.fullPage || true;
173+
const fullPage = config.mobile.fullPage ?? true;
174174

175175
for (const device of devices) {
176176
const variant = `${snapshot.name}_${device}_${orientation}`;
177177

178178
if (!this.variants.includes(variant)) {
179179
allVariantsDropped = false; // Found a variant that needs processing
180180
if (!snapshot.options) snapshot.options = {};
181-
if (!snapshot.options.mobile) snapshot.options.mobile = { devices: [], orientation: constants.MOBILE_ORIENTATION_PORTRAIT };
181+
if (!snapshot.options.mobile) snapshot.options.mobile = { devices: [], orientation: constants.MOBILE_ORIENTATION_PORTRAIT, fullPage: fullPage };
182182

183183
if (!snapshot.options.mobile.devices.includes(device)) {
184184
snapshot.options.mobile.devices.push(device);
@@ -238,12 +238,12 @@ export default class Queue {
238238
snapshot.options = {};
239239
}
240240

241-
snapshot.options.mobile = { devices: [], orientation: constants.MOBILE_ORIENTATION_PORTRAIT };
242-
243241
const devices = mobileConfig.devices || [];
244242
const orientation = mobileConfig.orientation ?? this.ctx.config.mobile?.orientation ?? constants.MOBILE_ORIENTATION_PORTRAIT;
245243
const fullPage = mobileConfig.fullPage ?? this.ctx.config.mobile?.fullPage ?? true;
246244
let allVariantsDropped = true;
245+
246+
snapshot.options.mobile = { devices: [], orientation: constants.MOBILE_ORIENTATION_PORTRAIT, fullPage: fullPage };
247247

248248
for (const device of devices) {
249249
const variant = `${snapshot.name}_${device}_${orientation}`;
@@ -272,7 +272,7 @@ export default class Queue {
272272
if (snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name)) {
273273
if (!this.ctx.config.delayedUpload){
274274
drop = true;
275-
this.ctx.log.debug(`snapshot failed; Same snapshot has been encountered with defer Uploads being false`);
275+
this.ctx.log.debug(`snapshot failed; Same snapshot has been encountered with delayedUploads being false`);
276276
} else {
277277
drop = this.filterExistingVariants(snapshot, this.ctx.config);
278278
}

src/lib/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ export function getMobileRenderViewportsForOptions(options: any): Record<string,
157157
let portrait = (orientation === constants.MOBILE_ORIENTATION_PORTRAIT);
158158

159159
// Check if fullPage is specified, otherwise use default
160-
let fullPage = options.mobile.fullPage !== undefined ? options.mobile.fullPage : true;
160+
let fullPage
161+
if (options.mobile.fullPage === undefined || options.mobile.fullPage){
162+
fullPage = true
163+
} else {
164+
fullPage = false
165+
}
161166

162167
mobileRenderViewports[os]?.push({
163168
viewport: { width: portrait ? width : height, height: portrait ? height : width },

0 commit comments

Comments
 (0)