Skip to content

Commit

Permalink
feat: fix rule table page crash (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
love98ooo authored Aug 13, 2024
1 parent a05659f commit 1671f43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions web/src/SiteListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class SiteListPage extends BaseListPage {
domain: "door.casdoor.com",
otherDomains: [],
needRedirect: false,
disableVerbose: false,
rules: [],
challenges: [],
host: "",
port: 8000,
Expand Down
6 changes: 5 additions & 1 deletion web/src/components/RuleTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class RuleTable extends React.Component {
this.state = {
classes: props,
};
if (this.props.rules === null) {
// rerender
this.props.onUpdateRules([]);
}
}

updateTable(table) {
Expand Down Expand Up @@ -122,7 +126,7 @@ class RuleTable extends React.Component {
<Row style={{marginTop: "20px"}} >
<Col span={24}>
{
this.renderTable(this.props.rules.map((item, index) => {
this.props.rules === null ? null : this.renderTable(this.props.rules.map((item, index) => {
const values = item.split("/");
return {owner: values[0], name: values[1]};
}))
Expand Down

0 comments on commit 1671f43

Please sign in to comment.