@homebound/beam 2.244.1 → 2.244.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ The most concrete manifestation of this is that we want to _provide as few props
33
33
  Fewer props generally means:
34
34
 
35
35
  1. More consistent UX for users (the component cannot behave in N different ways, depending on the page the user sees it on)
36
- 2. Easier usage for client applications (fewer props to know and understand "...should I set this? or not?")
36
+ 2. Easier usage for client applications (fewer props to know and understand "...should I set this or not?")
37
37
  3. Simpler implementation for Beam components and maintainers
38
38
  4. More flexibility to change the internal implementations of Beam components and roll out them relatively easily.
39
39
 
@@ -3,10 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RightPaneLayout = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const framer_motion_1 = require("framer-motion");
6
+ const react_1 = require("react");
6
7
  const Css_1 = require("../../../Css");
7
8
  const RightPaneContext_1 = require("./RightPaneContext");
8
9
  function RightPaneLayout({ children, paneBgColor = Css_1.Palette.White, paneWidth = 450, }) {
9
- const { isRightPaneOpen, rightPaneContent, clearPane } = (0, RightPaneContext_1.useRightPaneContext)();
10
+ const { isRightPaneOpen, rightPaneContent, clearPane, closePane } = (0, RightPaneContext_1.useRightPaneContext)();
11
+ // Close pane on page unmount because otherwise the next page that has a right pane will show our stale content
12
+ (0, react_1.useEffect)(() => {
13
+ return () => {
14
+ closePane();
15
+ };
16
+ }, []);
10
17
  return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.df.overflowXHidden.$, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.w(`calc(100% - ${paneWidth + 24}px)`)
11
18
  .add("transition", "width .2s linear")
12
19
  .h100.mr3.overflowXAuto.if(!isRightPaneOpen).w100.mr0.$, children: children }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: isRightPaneOpen && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { layout: "position", "data-testid": "rightPaneContent", css: Css_1.Css.bgColor(paneBgColor).h100.wPx(paneWidth).$,
@@ -48,7 +48,7 @@ export declare class TableState {
48
48
  setRows(rows: GridDataRow<any>[]): void;
49
49
  setColumns(columns: GridColumnWithId<any>[], visibleColumnsStorageKey: string | undefined): void;
50
50
  /** Determines which columns to expand immediately vs async */
51
- parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): void;
51
+ parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): Promise<void>;
52
52
  /** Updates the state of which columns are expanded */
53
53
  updateExpandedColumns(newColumns: GridColumnWithId<any>[]): void;
54
54
  loadExpandedColumns(column: GridColumnWithId<any>): Promise<void>;
@@ -201,7 +201,7 @@ class TableState {
201
201
  }
202
202
  }
203
203
  /** Determines which columns to expand immediately vs async */
204
- parseAndUpdateExpandedColumns(columnsToExpand) {
204
+ async parseAndUpdateExpandedColumns(columnsToExpand) {
205
205
  // Separate out which columns need to be loaded async vs which can be loaded immediately.
206
206
  const [localColumnsToExpand, asyncColumnsToExpand] = columnsToExpand.reduce((acc, c) => {
207
207
  if ((0, utils_2.isFunction)(c.expandColumns)) {
@@ -212,7 +212,16 @@ class TableState {
212
212
  // Handle all async expanding columns using a Promise.all.
213
213
  // This will allow the table to render immediately, then cause a rerender with the new columns
214
214
  if (asyncColumnsToExpand.length > 0) {
215
- Promise.all(asyncColumnsToExpand.map(async (c) => await this.loadExpandedColumns(c))).then(() => this.updateExpandedColumns(asyncColumnsToExpand));
215
+ // Note: Not using a Promise.all because there seems to be a bug in Apollo with applying TypePolicies when using Promise.all.
216
+ // TODO: Update comment with Apollo issue link.
217
+ // Promise.all(asyncColumnsToExpand.map(async (c) => await this.loadExpandedColumns(c))).then(() =>
218
+ // this.updateExpandedColumns(asyncColumnsToExpand),
219
+ // );
220
+ // Instead, doing each async request in sequence for now.
221
+ for await (const column of asyncColumnsToExpand) {
222
+ await this.loadExpandedColumns(column);
223
+ }
224
+ this.updateExpandedColumns(asyncColumnsToExpand);
216
225
  }
217
226
  // For local columns, we skip the Promise in order to have the correct state on the initial load.
218
227
  if (localColumnsToExpand.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.244.1",
3
+ "version": "2.244.3",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",