Skip to content

Commit

Permalink
Removed nullish coalescing operator (??)
Browse files Browse the repository at this point in the history
It caused problems with default create-react-app configuration.
  • Loading branch information
bvaughn committed Jan 10, 2023
1 parent d837524 commit 8677dab
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
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

0 comments on commit 8677dab

Please sign in to comment.