Skip to content

Commit

Permalink
feat: set projectId from url
Browse files Browse the repository at this point in the history
  • Loading branch information
aquino-luane committed Oct 28, 2024
1 parent 7c771fd commit dd99715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/hash-parser-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const HashParserHOC = function (WrappedComponent) {
window.removeEventListener('hashchange', this.handleHashChange);
}
handleHashChange () {
const hashMatch = window.location.hash.match(/#(\d+)/);
const hashMatch = window.location.hash.match(/\/(\d+)$/);
const hashProjectId = hashMatch === null ? defaultProjectId : hashMatch[1];
this.props.setProjectId(hashProjectId.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/project-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const START_REMIXING = 'scratch-gui/project-state/START_REMIXING';
const START_UPDATING_BEFORE_CREATING_COPY = 'scratch-gui/project-state/START_UPDATING_BEFORE_CREATING_COPY';
const START_UPDATING_BEFORE_CREATING_NEW = 'scratch-gui/project-state/START_UPDATING_BEFORE_CREATING_NEW';

const defaultProjectId = '1'; // hardcoded id of default project
const defaultProjectId = '0'; // hardcoded id of default project

const LoadingState = keyMirror({
NOT_LOADED: null,
Expand Down

0 comments on commit dd99715

Please sign in to comment.