Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed nullish coalescing operator (??) #74

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Content() {

const { currentFileIndex, fileListCollapsed, openFiles } = state;

const currentFile = openFiles[currentFileIndex] ?? null;
const currentFile = openFiles[currentFileIndex] || null;

const closeFile = (file: File) => {
dispatch({ type: "close", file });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function processSection(
section: string,
className: string
) {
const tokenType = className?.substring(4) ?? null; // Remove "tok-" prefix;
const tokenType = className?.substring(4) || null; // Remove "tok-" prefix;

let index = 0;
let nextIndex = section.indexOf("\n");
Expand Down
4 changes: 2 additions & 2 deletions packages/react-resizable-panels/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changelog

## 0.0.31
* [#71](https://github.com/bvaughn/react-resizable-panels/pull/71): Added `getSize` and `getCollapsed` to imperative API exposed by `Panel`.

* [#71](https://github.com/bvaughn/react-resizable-panels/issues/71): Added `getSize` and `getCollapsed` to imperative API exposed by `Panel`.
* [#67](https://github.com/bvaughn/react-resizable-panels/issues/67), [#72](https://github.com/bvaughn/react-resizable-panels/issues/72): Removed nullish coalescing operator (`??`) because it caused problems with default create-react-app configuration.
## 0.0.30
* [#68](https://github.com/bvaughn/react-resizable-panels/pull/68): Reduce volume/frequency of local storage writes for `PanelGroup`s configured to _auto-save_.
* Added `onLayout` prop to `PanelGroup` to be called when group layout changes. Note that some form of debouncing is recommended before processing these values (e.g. saving to a database).
Expand Down
6 changes: 3 additions & 3 deletions packages/react-resizable-panels/src/utils/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function getResizeHandleIndex(id: string): number | null {
const index = handles.findIndex(
(handle) => handle.getAttribute("data-panel-resize-handle-id") === id
);
return index ?? null;
return index || null;
}

export function getResizeHandles(): HTMLDivElement[] {
Expand All @@ -206,8 +206,8 @@ export function getResizeHandlePanelIds(
const handles = getResizeHandlesForGroup(groupId);
const index = handles.indexOf(handle);

const idBefore: string | null = panelsArray[index]?.id ?? null;
const idAfter: string | null = panelsArray[index + 1]?.id ?? null;
const idBefore: string | null = panelsArray[index]?.id || null;
const idAfter: string | null = panelsArray[index + 1]?.id || null;

return [idBefore, idAfter];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-resizable-panels/src/utils/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function loadPanelLayout(
const state = loadSerializedPanelGroupState(autoSaveId);
if (state) {
const key = getSerializationKey(panels);
return state[key] ?? null;
return state[key] || null;
}

return null;
Expand Down